[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA: gEDA/gaf 20050313 almost ready, but not released...
Hi All,
I was doing my last bits of cleanup / additions before doing
the release (mainly symbols) when I observed some rather unpleasant
behavior. Basically gschem upon exit would hang. Looking in
the debugger, gschem was getting stuck in a malloc call caused by
a g_strdup_printf (in o_undo.nw:o_undo_cleanup). Usually when this
happens it points to the heap that is seriously messed up. I don't think
that the undo code is the problem.
So, I ran valgrind against gschem and it generated the following
error (in a different part of the code):
==31275== Invalid free() / delete / delete[]
==31275== at 0x1B907460: free (vg_replace_malloc.c:153)
==31275== by 0x1BBBB9F3: g_free (in /usr/lib/libglib-2.0.so.0.600.1)
==31275== by 0x1BBA9289: (within /usr/lib/libglib-2.0.so.0.600.1)
==31275== by 0x1BBA8E8A: (within /usr/lib/libglib-2.0.so.0.600.1)
==31275== Address 0x1C69F980 is 0 bytes inside a block of size 228 free'd
==31275== at 0x1B907460: free (vg_replace_malloc.c:153)
==31275== by 0x1BBBB9F3: g_free (in /usr/lib/libglib-2.0.so.0.600.1)
==31275== by 0x1B92BD9A: delete_font_set (o_text_basic.nw:1491)
==31275== by 0x1BBA8DB5: (within /usr/lib/libglib-2.0.so.0.600.1)
Usually when valgrind complains, it is a legit problem.
The code in question is:
static gboolean
delete_font_set (gpointer key, gpointer value, gpointer user_data)
{
OBJECT *tmp = (OBJECT*)value;
TOPLEVEL *toplevel = (TOPLEVEL*)user_data;
if (tmp != NULL) {
if (tmp->font_prim_objs != NULL) {
s_delete_list_fromstart (toplevel, tmp->font_prim_objs);
tmp->font_prim_objs = NULL;
}
/* do not use s_delete() as tmp is not fully initialized */
g_free (tmp->name);
g_free (tmp); <---- This is what valgrind is complaining about.
}
return TRUE;
}
Do we really need to free the hash value itself inside of the delete
function?
I'll keep looking at this (and run efence), but in the mean time,
I don't want to release with such a glaring problem. Sorry. ;-(
I'm hoping that this is the cause of the malloc hang.
-Ales