libc/minimal: reallocarray() in terms of realloc()
reallocarray() is defined in terms of realloc(). From OpenBSD manual pages: "Designed for safe allocation of arrays, the reallocarray() function is similar to realloc() except it operates on nmemb members of size size and checks for integer overflow in the calculation nmemb * size." The return value of sys_heap_realloc() is not compatible with that of realloc(). Signed-off-by: Martin Åberg <martin.aberg@gaisler.com>
This commit is contained in:
parent
22c0d0155a
commit
180ce491ad
1 changed files with 1 additions and 1 deletions
|
@ -118,7 +118,7 @@ void *reallocarray(void *ptr, size_t nmemb, size_t size)
|
||||||
errno = ENOMEM;
|
errno = ENOMEM;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return sys_heap_realloc(&z_malloc_heap, ptr, size);
|
return realloc(ptr, size);
|
||||||
#else
|
#else
|
||||||
return NULL;
|
return NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue