diff --git a/lib/libc/minimal/source/stdlib/malloc.c b/lib/libc/minimal/source/stdlib/malloc.c index d0fd473fd7b..2ec25b17c4b 100644 --- a/lib/libc/minimal/source/stdlib/malloc.c +++ b/lib/libc/minimal/source/stdlib/malloc.c @@ -102,6 +102,10 @@ void *realloc(void *ptr, size_t requested_size) size_t block_size, total_requested_size; void *new_ptr; + if (ptr == NULL) { + return malloc(requested_size); + } + if (requested_size == 0) { return NULL; }