delete a pointer after it was assigned the return of a strdup()?
is this necessary?
after i started using strdup in conjunction with modal dialog''s in an mfc program my program starts to crash when i exit.
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement