GNOME Bugzilla – Bug 607358
Saving leak files twice, memprof crashes
Last modified: 2010-02-04 11:58:35 UTC
When computing and saving twice a log file for the same process, memprof crashes. The issue is in main.c, both for functions save_leak_cb and save_profile_cb where some memory is freed twice. The following patch on file main.c solves the issue: @@ -1098,11 +1098,12 @@ filename = get_filename ("Save Leak Report", suggestion ? suggestion : "memprof.leak"); if (filename) { - g_free (suggestion); + if(suggestion){ + g_free (suggestion); + } suggestion = filename; leaks_print (pwin->process, pwin->leaks, filename); - g_free (filename); } } } @@ -1119,11 +1120,13 @@ filename = get_filename ("Save Profile", suggestion ? suggestion : "memprof.out"); if (filename) { - g_free (suggestion); + if(suggestion){ + g_free (suggestion); + } + suggestion = filename; profile_write (pwin->profile, filename); - g_free (filename); } } }
Thanks. I applied this and will push it in a second.
This is currently on the external gitorious tree. It will be in git.gnome.org in a few days.