Index: src/OFObject.m ================================================================== --- src/OFObject.m +++ src/OFObject.m @@ -134,12 +134,14 @@ } void * OFResizeMemory(void *pointer, size_t count, size_t size) { - if OF_UNLIKELY (count == 0 || size == 0) + if OF_UNLIKELY (count == 0 || size == 0) { + free(pointer); return NULL; + } if OF_UNLIKELY (count > SIZE_MAX / size) @throw [OFOutOfRangeException exception]; if OF_UNLIKELY ((pointer = realloc(pointer, count * size)) == NULL)