diff --git a/WINGs/ChangeLog b/WINGs/ChangeLog index 1f870870..e25e64de 100644 --- a/WINGs/ChangeLog +++ b/WINGs/ChangeLog @@ -29,6 +29,10 @@ changes since wmaker 0.61.1: problem with them: inability to remove handlers next to the called one, from the called handler itself. Trying to do this with the old version caused the program to crash. +- changed wrealloc behaviour to be like this: new = wrealloc(old, new_size); + 1. if old is NULL, return wmalloc(new_size). + 2. if new_size is 0, call wfree(old), and return NULL. + 3. if both old is a valid pointer and new_size>0, call realloc. changes since wmaker 0.61.0: ............................ diff --git a/WINGs/memory.c b/WINGs/memory.c index dbe60c2a..89f3ad5d 100644 --- a/WINGs/memory.c +++ b/WINGs/memory.c @@ -114,6 +114,9 @@ void *wrealloc(void *ptr, size_t newsize) if (!ptr) { nptr = wmalloc(newsize); + } else if (newsize==0) { + wfree(ptr); + nptr = NULL; } else { #ifdef TEST_WITH_GC nptr = GC_realloc(ptr, newsize);