Click here to Skip to main content
15,886,873 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow to delete char Array-Memory leak detection Pin
Anu_Bala17-Jul-11 20:55
Anu_Bala17-Jul-11 20:55 
AnswerRe: How to delete char Array-Memory leak detection Pin
CPallini17-Jul-11 21:36
mveCPallini17-Jul-11 21:36 
AnswerRe: How to delete char Array-Memory leak detection Pin
Code-o-mat17-Jul-11 21:55
Code-o-mat17-Jul-11 21:55 
GeneralRe: How to delete char Array-Memory leak detection Pin
Anu_Bala17-Jul-11 22:14
Anu_Bala17-Jul-11 22:14 
GeneralRe: How to delete char Array-Memory leak detection Pin
Code-o-mat17-Jul-11 22:31
Code-o-mat17-Jul-11 22:31 
GeneralRe: How to delete char Array-Memory leak detection Pin
Anu_Bala17-Jul-11 22:39
Anu_Bala17-Jul-11 22:39 
GeneralRe: How to delete char Array-Memory leak detection Pin
Code-o-mat17-Jul-11 22:47
Code-o-mat17-Jul-11 22:47 
GeneralRe: How to delete char Array-Memory leak detection Pin
Stefan_Lang20-Jul-11 1:21
Stefan_Lang20-Jul-11 1:21 
Judging by that function signature, GetResource will either allocate a string for you, or return a pointer to a string it stores internally (or statically). In either case, the pointer you pass will be overwritten, and any memory previously allocated that this pointer used to point to will be lost!

So, what you should do is:

1. do not allocate memory yourself!
2. initialize the pointer with NULL instead, before calling GetResource()
3. Check the documentation of GetResource() whether or not it allocates memory that needs to be freed or not. If your delete causes an error, then most likely it shouldn't be deleted, or it already gets deleted by whoever manages these resources.
AnswerRe: How to delete char Array-Memory leak detection Pin
Albert Holguin18-Jul-11 5:31
professionalAlbert Holguin18-Jul-11 5:31 
QuestionHow to open and read/write from multiple serial ports at the same time? Pin
Le@rner17-Jul-11 20:42
Le@rner17-Jul-11 20:42 
AnswerRe: How to open and read/write from multiple serial ports at the same time? Pin
Code-o-mat17-Jul-11 20:50
Code-o-mat17-Jul-11 20:50 
GeneralRe: How to open and read/write from multiple serial ports at the same time? Pin
Le@rner17-Jul-11 20:56
Le@rner17-Jul-11 20:56 
GeneralRe: How to open and read/write from multiple serial ports at the same time? Pin
Code-o-mat17-Jul-11 21:36
Code-o-mat17-Jul-11 21:36 
GeneralRe: How to open and read/write from multiple serial ports at the same time? Pin
Le@rner17-Jul-11 21:38
Le@rner17-Jul-11 21:38 
GeneralRe: How to open and read/write from multiple serial ports at the same time? Pin
Code-o-mat17-Jul-11 21:52
Code-o-mat17-Jul-11 21:52 
GeneralRe: How to open and read/write from multiple serial ports at the same time? Pin
Le@rner17-Jul-11 22:05
Le@rner17-Jul-11 22:05 
GeneralRe: How to open and read/write from multiple serial ports at the same time? Pin
Code-o-mat17-Jul-11 22:35
Code-o-mat17-Jul-11 22:35 
GeneralMessage Removed Pin
16-Dec-11 0:14
Le@rner16-Dec-11 0:14 
GeneralRe: How to open and read/write from multiple serial ports at the same time? Pin
Code-o-mat16-Dec-11 0:29
Code-o-mat16-Dec-11 0:29 
Questionarray declaration Pin
Danzy8317-Jul-11 10:17
Danzy8317-Jul-11 10:17 
AnswerRe: array declaration Pin
Richard Andrew x6417-Jul-11 10:47
professionalRichard Andrew x6417-Jul-11 10:47 
GeneralRe: array declaration [modified] Pin
Danzy8317-Jul-11 11:56
Danzy8317-Jul-11 11:56 
GeneralRe: array declaration Pin
Richard Andrew x6417-Jul-11 13:45
professionalRichard Andrew x6417-Jul-11 13:45 
GeneralRe: array declaration Pin
Richard MacCutchan17-Jul-11 22:59
mveRichard MacCutchan17-Jul-11 22:59 
AnswerRe: array declaration Pin
«_Superman_»17-Jul-11 15:45
professional«_Superman_»17-Jul-11 15:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.