Click here to Skip to main content
16,006,531 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionC question, can't free string from a struct Pin
gizmokaka7-Sep-07 15:06
gizmokaka7-Sep-07 15:06 
AnswerRe: C question, can't free string from a struct Pin
Leslie Sanford7-Sep-07 15:28
Leslie Sanford7-Sep-07 15:28 
GeneralRe: C question, can't free string from a struct Pin
gizmokaka7-Sep-07 21:51
gizmokaka7-Sep-07 21:51 
AnswerRe: C question, can't free string from a struct Pin
John R. Shaw7-Sep-07 17:30
John R. Shaw7-Sep-07 17:30 
GeneralRe: C question, can't free string from a struct Pin
gizmokaka7-Sep-07 22:01
gizmokaka7-Sep-07 22:01 
GeneralRe: C question, can't free string from a struct Pin
John R. Shaw7-Sep-07 22:34
John R. Shaw7-Sep-07 22:34 
GeneralRe: C question, can't free string from a struct Pin
gizmokaka7-Sep-07 23:05
gizmokaka7-Sep-07 23:05 
GeneralRe: C question, can't free string from a struct Pin
John R. Shaw7-Sep-07 23:42
John R. Shaw7-Sep-07 23:42 
The original code snippet I posted shows everything you need to know about freeing that type of array. What the rest of your code is doing, I have no clue.

The only thing wrong with your second post of code was that it did not check if any of the pointers where NULL before freeing them, nor did you set them to NULL after freeing them. Of course that was basically the problem with you first post of code.

I have not seen, nor want to, the rest of your code, but you should also make sure that any slot (colName[0] is a slot) is empty (points to NULL) before assigning a new pointer to it, or you will again have memory leaks.


INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra

GeneralRe: C question, can't free string from a struct Pin
Leslie Sanford7-Sep-07 22:34
Leslie Sanford7-Sep-07 22:34 
GeneralRe: C question, can't free string from a struct Pin
John R. Shaw7-Sep-07 22:54
John R. Shaw7-Sep-07 22:54 
GeneralRe: small sample of where problem ocurres. Pin
gizmokaka7-Sep-07 22:34
gizmokaka7-Sep-07 22:34 
GeneralRe: small sample of where problem ocurres. Pin
John R. Shaw7-Sep-07 22:42
John R. Shaw7-Sep-07 22:42 
GeneralRe: small sample of where problem ocurres. Pin
markkuk7-Sep-07 23:12
markkuk7-Sep-07 23:12 
GeneralRe: small sample of where problem ocurres. Pin
gizmokaka7-Sep-07 23:21
gizmokaka7-Sep-07 23:21 
GeneralRe: small sample of where problem ocurres. Pin
John R. Shaw7-Sep-07 23:24
John R. Shaw7-Sep-07 23:24 
GeneralRe: small sample of where problem ocurres. Pin
Leslie Sanford7-Sep-07 23:42
Leslie Sanford7-Sep-07 23:42 
GeneralRe: Another qestion on the same subject. Pin
gizmokaka8-Sep-07 0:20
gizmokaka8-Sep-07 0:20 
GeneralRe: small sample of where problem ocurres. Pin
Russell'7-Sep-07 23:33
Russell'7-Sep-07 23:33 
QuestionClosing a view Pin
bob169727-Sep-07 11:08
bob169727-Sep-07 11:08 
AnswerRe: Closing a view Pin
Russell'7-Sep-07 23:02
Russell'7-Sep-07 23:02 
GeneralRe: Closing a view Pin
bob169728-Sep-07 4:44
bob169728-Sep-07 4:44 
GeneralRe: Closing a view Pin
Mark Salsbery8-Sep-07 7:04
Mark Salsbery8-Sep-07 7:04 
GeneralRe: Closing a view Pin
bob169728-Sep-07 9:14
bob169728-Sep-07 9:14 
GeneralRe: Closing a view Pin
Mark Salsbery8-Sep-07 10:51
Mark Salsbery8-Sep-07 10:51 
AnswerRe: Closing a view Pin
Nelek12-Sep-07 0:02
protectorNelek12-Sep-07 0:02 

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.