This topic is now archived and is closed to further replies.


delete a pointer after it was assigned the return of a strdup()?

Recommended Posts

If you looked at the definition of strdup(), you would see that it should be followed by a call to free() when you no longer need the string. A memory leak should not crash your program upon exit but calling delete[] instead of free() on the allocated string might.

Share this post

Link to post
Share on other sites