Update assertions in realloc() and free() to allow for deallocation during
initializtion.
This commit is contained in:
parent
662a017c1d
commit
a25d0a8a72
@ -4897,8 +4897,8 @@ malloc_init_hard(void)
|
|||||||
if (malloc_initialized || malloc_initializer == pthread_self()) {
|
if (malloc_initialized || malloc_initializer == pthread_self()) {
|
||||||
/*
|
/*
|
||||||
* Another thread initialized the allocator before this one
|
* Another thread initialized the allocator before this one
|
||||||
* acquired init_lock, or this thread is the inializing thread,
|
* acquired init_lock, or this thread is the initializing
|
||||||
* and it is recursively allocating.
|
* thread, and it is recursively allocating.
|
||||||
*/
|
*/
|
||||||
malloc_mutex_unlock(&init_lock);
|
malloc_mutex_unlock(&init_lock);
|
||||||
return (false);
|
return (false);
|
||||||
@ -5613,7 +5613,8 @@ realloc(void *ptr, size_t size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ptr != NULL) {
|
if (ptr != NULL) {
|
||||||
assert(malloc_initialized);
|
assert(malloc_initialized || malloc_initializer ==
|
||||||
|
pthread_self());
|
||||||
|
|
||||||
ret = iralloc(ptr, size);
|
ret = iralloc(ptr, size);
|
||||||
|
|
||||||
@ -5659,7 +5660,8 @@ free(void *ptr)
|
|||||||
{
|
{
|
||||||
|
|
||||||
if (ptr != NULL) {
|
if (ptr != NULL) {
|
||||||
assert(malloc_initialized);
|
assert(malloc_initialized || malloc_initializer ==
|
||||||
|
pthread_self());
|
||||||
|
|
||||||
idalloc(ptr);
|
idalloc(ptr);
|
||||||
UTRACE(ptr, 0, 0);
|
UTRACE(ptr, 0, 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user