> Hi All,
>
> I am a newbee to PalmOS. I have a Problem using Char* in my application.
> Please suggest me where I am wrong.
>
> Here is the sample code for the same.
>
> /Public Variable
>
> Char* root;
> Char* Attrib;
>
> ReadTag(Char* input)
> {
>
> root = ReadAttrib(Char*);
> MemPtrFree(Attrib);
> Attrib = NULL;
>
> // Store root in List1
>
> }
>
> Char* ReadAttrib(Char*)
> {
> Attrib = MemPtrNew(sizeof(Char[100]));
> // Read Through List2
>
> // Return Attrib;
> }

The short answer is that you are freeing the memory block prematurely.
The freeing of Attrib should be deferred until after you have finished with
root.

The long answer is that your code is a mess.



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

Reply via email to