libc: minimal: fix realloc function
Excerpt from the manual: If ptr is NULL, then the call is equivalent to malloc(size) [...] Without this commit, such calls end with a BUS FAULT. Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
This commit is contained in:
parent
4d9486fc22
commit
1afa9d0e5d
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue