This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: Random failures when calling free()/malloc()
On Sat, 2003-07-19 at 12:32, Martin Schlemmer wrote:
> Anyhow, with the latest glibc/gcc, I get a new one that do not die
> when calling unlink():
>
> ----------------------------------------------------
> Program received signal SIGSEGV, Segmentation fault.
> 0x4065b25b in __libc_free (mem=0x81fda68) at malloc.c:3353
> 3353 (void)mutex_lock(&ar_ptr->mutex);
> (gdb) bt
> #0 0x4065b25b in __libc_free (mem=0x81fda68) at malloc.c:3353
> #1 0x405a353d in g_free (mem=0x81fda68) at gmem.c:186
> #2 0x405c17f0 in g_utf8_collate_key (str=0x81fda48 "ld", len=-1) at
> gunicollate.c:211
> #3 0x402abfaa in open_new_dir (dir_name=0x81edbc0
> "/space/var/tmp/portage/binutils-2.14.90.0.4.1-r1/work/binutils-2.14.90.0.4.1", sbuf=0xbfffc6b0,
> stat_subdirs=1) at gtkfilesel.c:3143
> #4 0x402ac3b7 in open_dir (dir_name=0x81edbc0
> "/space/var/tmp/portage/binutils-2.14.90.0.4.1-r1/work/binutils-2.14.90.0.4.1",
> cmpl_state=0x81edb70)
> at gtkfilesel.c:3276
This is classic memory corruption, probably a double free somewhere
in your application. It's certainly not libc, and unlikely
to be GLib/GTK+ either... memory corruption failures are frequently
not 'local' - a bug in one place will cause a crash somewhere
else.
'export MALLOC_CHECK_=2' valgrind, or even the good old standby of
Electric Fence should help you track it down.
Regards,
Owen