Will this leak memory?

it's not the recommended choice, one tend to avoid using explicitly new and delete.


it's also a bad practice to allocate the memory and then hand over the pointer to something else. The best practice is to let the caller provide the storage.

regarding the null terminator, sprintf() will add that for you. I would suggest snprintf() just to be on the safe side and never overflow