Morten Schmidt wrote:
Why does this make a 1 memory leak in PalmOS 4.12 but not in 5?

It probably leaks in 5, but it's just not being reported the same.



void SetTriggerText(UInt16 ownerForm, UInt16 trigger, char *text)
{
    MemHandle h;
    Char *dest;
    if( text == NULL )
        text = "";
    h = MemHandleNew( StrLen( text ) + 1 );
    dest = MemHandleLock( h );
    StrCopy(dest, text);
    CtlSetLabel(GetObjectPtr(ownerForm, trigger), dest);
    MemHandleUnlock( h );
}

...and how do I keep it from doing so?

Try freeing h before your app exits.


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

Reply via email to