I'm writing a function that saved data stored in a text field.

The function checks if there is anything in the field, if there isn't it
quits the function without saving. In order to check whether there's text in
the field I've allocated a pointer to FieldType & a char* pointer which is
set by FldGetTextPtr().

Question is, do I need to release this memory before I quit the function. In
other words do the pointers returned by the APIs used to get information
from objects in the form point to new copies of the objects pointers or do
they point to the actual form data (which means it isn't my problem what
happens to the memory pointed by these pointers as the PalmOS will release
it when I close the form).

here's a snippet of the code:

void EditForm_SaveData(ObjectsDbInfoType * objectsDbInfo)
{

     //use utility function to get pointer for next function (see below)
     FieldType *fldP = GetObjectPtr<FieldType>(EditField);

     //Get current text
     char *textP = FldGetTextPtr (fldP);

     // Quit if nothing entered
     if (!StrLen(textP) || !textP)
          return;

----cut---
}

As you can see I quit without releasing the memory pointed at by my pointers
but assigned by API calls.

--
thanks,
Ash



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

Reply via email to