NetBSD mi_reallocarr should update errno (based on PR #499 by @devexen)

This commit is contained in:
daan 2021-12-17 13:40:39 -08:00
parent faf2a7020c
commit f5ea6c70bd

View File

@ -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
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* newp = mi_reallocarray(*op, count, size);
if (mi_unlikely(newp == NULL)) return errno;