Defined tableFree(NULL).
This commit is contained in:
parent
9e11c36f63
commit
ddb4533aff
|
@ -15,7 +15,7 @@ static BOOL runHandlers(const handlerfunc list[], struct table *t, UINT uMsg, WP
|
|||
|
||||
// memory allocation stuff
|
||||
// each of these functions do an implicit ZeroMemory()
|
||||
// these also make tableRealloc(NULL, ...) act like realloc(NULL, ...) (that is, same as tableAlloc(...)/malloc(...))
|
||||
// these also make tableRealloc(NULL, ...)/tableFree(NULL) act like realloc(NULL, ...)/free(NULL) (that is, same as tableAlloc(...)/malloc(...) and a no-op, respectively)
|
||||
// we're using LocalAlloc() because:
|
||||
// - whether the malloc() family supports the last-error code is undefined
|
||||
// - the HeapAlloc() family DOES NOT support the last-error code; you're supposed to use Windows exceptions, and I can't find a clean way to do this with MinGW-w64 that doesn't rely on inline assembly or external libraries (unless they added __try/__except blocks)
|
||||
|
@ -46,6 +46,8 @@ static void *tableRealloc(void *p, size_t size, const char *panicMessage)
|
|||
|
||||
static void tableFree(void *p, const char *panicMessage)
|
||||
{
|
||||
if (p == NULL)
|
||||
return;
|
||||
if (LocalFree((HLOCAL) p) != NULL)
|
||||
panic(panicMessage);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue