Hi.

I have encountered the Ptr problem where there is a pointer to char
pointer, I allocate a MemPtrNew to the pointer to do some manipulation.
After using it and would like to free it in the StopApplication, it give me
an error where the pointer i free was an unallocated chunk. If i didn't
free it, it is another error where there is an unfreed chunk when exiting
the application.

The snippet code is in local form.

Char **title;
FldPtr field = (FldPtr) GetObjectPtr(TextField);

Char *text = FldGetTextPtr (field);

*title = (Char*)MemPtrNew(StrLen(text)+1);

StrCopy(*title, text);

Whenever i don't want to use it anymore, so i have to free the chunk in
StopApp:

if(*title!=NULL)
  MemPtrFree(*title) ;        //It give me an error that the chunk has not
been allocated.
                      if i don't free it, it give me another error as
unfreed chunk has encoutered.

where was i wrong? Could somebody guide me? Thank you in advance!





-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to