r19986 - gnucash/trunk/src/gnome-utils - Fix more memory leaks. scm_to_locale_string() returns a string which must be freed.

Phil Longstaff plongstaff at code.gnucash.org
Tue Dec 28 20:39:49 EST 2010


Author: plongstaff
Date: 2010-12-28 20:39:49 -0500 (Tue, 28 Dec 2010)
New Revision: 19986
Trac: http://svn.gnucash.org/trac/changeset/19986

Modified:
   gnucash/trunk/src/gnome-utils/gnc-menu-extensions.c
Log:
Fix more memory leaks.  scm_to_locale_string() returns a string which must be freed.


Modified: gnucash/trunk/src/gnome-utils/gnc-menu-extensions.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-menu-extensions.c	2010-12-29 01:36:26 UTC (rev 19985)
+++ gnucash/trunk/src/gnome-utils/gnc-menu-extensions.c	2010-12-29 01:39:49 UTC (rev 19986)
@@ -172,9 +172,17 @@
         if (scm_is_string(item))
         {
             if (i == 1)
-                strings[i] = g_strdup(scm_to_locale_string(item));
+            {
+                strings[i] = scm_to_locale_string(item);
+            }
             else
-                strings[i] = g_strdup(gettext(scm_to_locale_string(item)));
+            {
+                gchar* s;
+
+                s = scm_to_locale_string(item);
+                strings[i] = g_strdup(gettext(s));
+                free(s);
+            }
         }
         else
         {
@@ -253,7 +261,8 @@
 {
     ExtensionInfo *ext_info;
     gchar *typeStr, *tmp;
-    const gchar *name, *guid;
+    gchar* name;
+    gchar* guid;
 
     ext_info = g_new0(ExtensionInfo, 1);
     ext_info->extension = extension;
@@ -274,6 +283,8 @@
     ext_info->ae.stock_id = NULL;
     ext_info->ae.accelerator = NULL;
     ext_info->ae.callback = NULL;
+    free(name);
+    free(guid);
 
     tmp = g_strdup_printf("%s/%s", ext_info->path, ext_info->ae.label);
     ext_info->sort_key = g_utf8_collate_key(tmp, -1);



More information about the gnucash-changes mailing list