Hy all

I use the function below to fill a list into my app. The list is filled
using the pointer
Char **itemList;

And, where the form receives the frmCloseEvent, i call the function
MemPtrFree to Free the memory used by the list,like this

Err a;
a=MemPtrFree(itemList);

and MemPtrFree return 0, that indicates that no error ocurred. But, when i
close the emulator, it tell me that there was memory leaks on the app. When
i see the log file, it show me the itens that was on my list.

Does anybody knows what is wrong?

This the code that i use the fill the Char **itemList:

void LoadClientList()
{

MemHandle h;

Char *CodCli;
Char *NomeCli;
UInt16 count, RecNum;


FormPtr form = FrmGetActiveForm();
ListPtr lptr = (ListPtr)FrmGetObjectPtr(form, FrmGetObjectIndex(form,
lstClientes));

//Inicio do Processo de Carregamento dos Dados na lista
dbPtrF = NULL;
OpenDatabase(&dbPtrF, "SAF_CLIENTES");
RecNum = DmNumRecords(dbPtrF);

//Configura o tamanho do ponteiro que tera os itens da lista/
itemList = (Char **) MemPtrNew(40 * RecNum * sizeof(Char *));



//Loop p/ carregar os itens na lista
for (count =0; count < RecNum; count++)
{

h = DmQueryRecord(dbPtrF, count);
CodCli = (Char *) MemHandleLock(h);
NomeCli = CodCli + StrLen(CodCli) + 1;
MemHandleUnlock(h);

itemList[count] = (char *)MemPtrNew(StrLen(NomeCli) * sizeof(Char *));
StrCopy(itemList[count], NomeCli);
}

DmCloseDatabase(dbPtrF);
LstSetListChoices(lptr, itemList, RecNum);
LstDrawList(lptr);
LstSetSelection(lptr,0);
}




Thanks all!


R�gis Daniel de Oliveira



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

Reply via email to