GNOME Bugzilla – Bug 357203
Invalid read reported by valgrind
Last modified: 2006-12-20 17:32:27 UTC
Backtrace: ==18889== Invalid read of size 1 ==18889== at 0x400621B: strcmp (mc_replace_strmem.c:340) ==18889== by 0x804F2AF: load_applications (bugzilla.c:383) ==18889== by 0x804CF23: main (bug-buddy.c:1152) ==18889== Address 0x5C32D40 is 0 bytes inside a block of size 10 free'd ==18889== at 0x4004FE0: free (vg_replace_malloc.c:233) ==18889== by 0x4B57270: g_free (gmem.c:187) ==18889== by 0x4027625: desktop_entry_unref (desktop-entries.c:432) ==18889== by 0x402A32D: gmenu_tree_item_unref (gmenu-tree.c:1396) ==18889== by 0x804F62B: load_applications (bugzilla.c:441) ==18889== by 0x804CF23: main (bug-buddy.c:1152)
This leads to crashes sometimes when bug-buddy starts. I've seen it crash a few times running under valgrind, but it's hard to get a backtrace when it happens
the invalid read is an error in gmenu_tree_entry_get_name (entry) returning some invalid address intead of NULL
should we move it there then?
yup.
Here's your bug: prev_name = gmenu_tree_entry_get_name (entry); g_key_file_free (key_file); gmenu_tree_item_unref (entry); prev_name is now freed and the pointer now points to an invalid address
Mark, thanks _a lot_ for pointing this. 2006-12-20 Fernando Herrera <fherrera@onirica.com> * src/bugzilla.c: (load_applications): dup the string from gmenu_tree_entry_get_name for prev_name before freeing the keyfile/entry. Fix bug #357203. Thanks to Mark McLoughlin!.