mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
According to the valgrind man-page, "the behaviour of realloc() with a size of zero is implementation defined in C17 and undefined in C23." The current glibc implementation frees the specified buffer, returns NULL and doesn't set errno. While this behavior is unlikely to change in the near future, code relying on it may not be compatible with other libc implementations. Also this realloc() use is flagged as an error in valgrind runs, making valgrind output less usable. Fix this by explicitly adding code to cover the realloc(buffer, 0) case in util_realloc(). Also change libutil users of realloc() to use util_realloc() instead. Reviewed-by: Steffen Eiden <seiden@linux.ibm.com> Signed-off-by: Peter Oberparleiter <oberpar@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
15 KiB
15 KiB