Memory leak when return char* from DLL
C / C++ / MFC
22
Posts
7
Posters
0
Views
1
Watching
-
shivanandgupta wrote:
if we use cData='\0' and after this "delete []cData;" then memory leak still continue.
Well, if you set cData to '\0' you are manipulating the pointer, not the data it contains. cData is set to null, and that is what you try to delete (and it always succeeds.) Doesn't the DLL supply an API for freeing this string? IMHO dll's should always be designed that way.
if we use delete without using '\0' then problem occur about heap at run time.
-
if we use delete without using '\0' then problem occur about heap at run time.