From: "druid" <[EMAIL PROTECTED]>
> Run it twice in a row and it will crash
> EditRecord()
>  {
(snip)
>   err = Open();
>   h = DmGetRecord(dbPtr, nRecordIndex);
(snip)    
>    MemHandleUnlock(h);
>    DmReleaseRecord(dbPtr, nRecordIndex, true);
>    err = DmCloseDatabase(dbPtr);
>    return 0;
>  }
> 
You're finishing with a DmCloseDatabase but it's not
clear from this code whether Open() opens the database
or returns a stored pointer.  Good practice is to allocate
and free resources at the same level so if you've got an
Open() function that does some special database management 
you should also have a Close() function to reverse this.  Of
course if Open() does something else entirely then your bug 
is elsewhere.

Chris Tutty



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

Reply via email to