 |
HeapFreePtr |
Function (ROM Call 0xA3) |
Frees a block allocated using HeapAllocPtr.
HeapFreePtr frees a heap block pointed to by Ptr. The block must be a block
which was allocated using the HeapAllocPtr command.
Do not attempt to use HeapFreePtr on a pointer which has changed after it was allocated
with HeapAllocPtr. For example, the following code
will certainly crash the calculator:
char *ptr = HeapAllocPtr (2);
if (ptr)
{
*(ptr++) = 'A'; // pointer changed here
*ptr = 0;
...
HeapFreePtr (ptr);
}
Instead, preserve the original pointer and pass it to HeapFreePtr.
Uses: HeapFree
Used by: UnloadDLL, fopen, scanf, vscanf, atexit