Thanks!  I was wondering about that, and it completely skipped my mind.

--

Tim Astle


Lee Fyock <[EMAIL PROTECTED]> wrote in message news:9802@palm-dev-forum...
>
> Tim said:
>
> >Okay, I fixed the problem... it was pretty stupid.  I should have caught
it
> >earlier!  It was staring me right in the face :-)
>
> and later
>
> >     /************ FORGOT TO TERMINATE STRING :-) **********/
> >     strResult[j] = '\0';
> >
> >     // Free memory
> >     MemPtrFree(lstr);
> >     MemPtrFree(strResult);
> >
> >     return(strResult);
>
> The last two lines are just about guaranteed to cause a crash later on.
> If you free the memory that strResult is using, returning strResult (and
> using it later on) will probably cause problems, since the memory it was
> using can be used by something else (and eventually will).
>
> If you're allocating memory in this routine and passing strResult back,
> whoever calls this routine must be responsible for freeing the memory
> when it's done with it.
>
> Good luck!
> Lee
>
>



-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palm.com/devzone/mailinglists.html

Reply via email to