mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 03:15:11 +00:00
b=566017; allow jemalloc posix_memalign to handle 0-sized allocs; r=jevans
This commit is contained in:
parent
e94d4e8f48
commit
ca83ae7876
@ -5829,6 +5829,19 @@ memalign(size_t alignment, size_t size)
|
||||
goto RETURN;
|
||||
}
|
||||
|
||||
if (size == 0) {
|
||||
#ifdef MALLOC_SYSV
|
||||
if (opt_sysv == false)
|
||||
#endif
|
||||
size = 1;
|
||||
#ifdef MALLOC_SYSV
|
||||
else {
|
||||
ret = NULL;
|
||||
goto RETURN;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
alignment = alignment < sizeof(void*) ? sizeof(void*) : alignment;
|
||||
ret = ipalloc(alignment, size);
|
||||
|
||||
@ -5863,6 +5876,8 @@ posix_memalign(void **memptr, size_t alignment, size_t size)
|
||||
return (EINVAL);
|
||||
}
|
||||
|
||||
/* The 0-->1 size promotion is done in the memalign() call below */
|
||||
|
||||
#ifdef MOZ_MEMORY_DARWIN
|
||||
result = moz_memalign(alignment, size);
|
||||
#else
|
||||
|
Loading…
Reference in New Issue
Block a user