cmocka: realloc(ptr, 0) should act as free(ptr)
Currently, realloc(ptr, 0) does not free the pointer as specified by
'man 3 realloc':
The realloc() function changes the size of the memory block pointed
to by ptr to size bytes. [...] if size is equal to zero, and ptr is
not NULL, then the call is equivalent to free(ptr). [...]
This causes a leak of the allocated memory, and tests that use this
particular realloc() pattern fail.
Signed-off-by: Niels de Vos <ndevos@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Jakub Hrozek <jakub.hrozek@posteo.se>
2 files changed