mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-28 00:21:52 +03:00
Restore locking in free_check.
This code is only used when MALLOC_CHECK_ is used. Then some bogus crashes and/or assert could result from the locking changes. The code ain't fast.
This commit is contained in:
@ -1,3 +1,8 @@
|
||||
2009-11-01 Ulrich Drepper <drepper@redhat.com>
|
||||
|
||||
* malloc/hooks.c (free_check): Restore locking and call _int_free
|
||||
appropriately.
|
||||
|
||||
2009-10-30 Ulrich Drepper <drepper@redhat.com>
|
||||
|
||||
* version.h (VERSION): Bump for 2.11 release.
|
||||
|
@ -276,13 +276,17 @@ free_check(mem, caller) Void_t* mem; const Void_t *caller;
|
||||
mchunkptr p;
|
||||
|
||||
if(!mem) return;
|
||||
(void)mutex_lock(&main_arena.mutex);
|
||||
p = mem2chunk_check(mem, NULL);
|
||||
if(!p) {
|
||||
(void)mutex_unlock(&main_arena.mutex);
|
||||
|
||||
malloc_printerr(check_action, "free(): invalid pointer", mem);
|
||||
return;
|
||||
}
|
||||
#if HAVE_MMAP
|
||||
if (chunk_is_mmapped(p)) {
|
||||
(void)mutex_unlock(&main_arena.mutex);
|
||||
munmap_chunk(p);
|
||||
return;
|
||||
}
|
||||
@ -291,12 +295,11 @@ free_check(mem, caller) Void_t* mem; const Void_t *caller;
|
||||
memset(mem, 0, chunksize(p) - (SIZE_SZ+1));
|
||||
#endif
|
||||
#ifdef ATOMIC_FASTBINS
|
||||
_int_free(&main_arena, p, 0);
|
||||
_int_free(&main_arena, p, 1);
|
||||
#else
|
||||
(void)mutex_lock(&main_arena.mutex);
|
||||
_int_free(&main_arena, p);
|
||||
(void)mutex_unlock(&main_arena.mutex);
|
||||
#endif
|
||||
(void)mutex_unlock(&main_arena.mutex);
|
||||
}
|
||||
|
||||
static Void_t*
|
||||
|
Reference in New Issue
Block a user