NetBSD mi_reallocarr should update errno (based on PR #499 by @devexen)
This commit is contained in:
parent
faf2a7020c
commit
f5ea6c70bd
@ -103,7 +103,10 @@ void* mi_reallocarray( void* p, size_t count, size_t size ) mi_attr_noexcept {
|
|||||||
|
|
||||||
int mi_reallocarr( void* p, size_t count, size_t size ) mi_attr_noexcept { // NetBSD
|
int mi_reallocarr( void* p, size_t count, size_t size ) mi_attr_noexcept { // NetBSD
|
||||||
mi_assert(p != NULL);
|
mi_assert(p != NULL);
|
||||||
if (p == NULL) return EINVAL; // should we set errno as well?
|
if (p == NULL) {
|
||||||
|
errno = EINVAL;
|
||||||
|
return EINVAL;
|
||||||
|
}
|
||||||
void** op = (void**)p;
|
void** op = (void**)p;
|
||||||
void* newp = mi_reallocarray(*op, count, size);
|
void* newp = mi_reallocarray(*op, count, size);
|
||||||
if (mi_unlikely(newp == NULL)) return errno;
|
if (mi_unlikely(newp == NULL)) return errno;
|
||||||
|
Loading…
Reference in New Issue
Block a user