After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 607358 - Saving leak files twice, memprof crashes
Saving leak files twice, memprof crashes
Status: RESOLVED FIXED
Product: memprof
Classification: Other
Component: general
0.6
Other All
: Normal normal
: ---
Assigned To: MemProf Maintainers
MemProf Maintainers
Depends on:
Blocks:
 
 
Reported: 2010-01-18 21:12 UTC by daniel.fredouille
Modified: 2010-02-04 11:58 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description daniel.fredouille 2010-01-18 21:12:23 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);
                }
        }
 }
Comment 1 Holger Hans Peter Freyther 2010-02-02 14:28:14 UTC
Thanks. I applied this and will push it in a second.
Comment 2 Holger Hans Peter Freyther 2010-02-04 11:58:35 UTC
This is currently on the external gitorious tree. It will be in git.gnome.org in a few days.