realloc(): fix possible memory leak

If size is equal to zero, and ptr is not NULL, then the call must be
equivalent to free(ptr).

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
This commit is contained in:
Nicolas Pitre 2019-07-11 15:37:19 -04:00 committed by Andrew Boie
commit ff7e4e69c8

View file

@ -96,6 +96,7 @@ void *realloc(void *ptr, size_t requested_size)
}
if (requested_size == 0) {
free(ptr);
return NULL;
}