r16066 - gnucash/trunk/src - Fix small memory leak - unfreed string.

Christian Stimming cstim at cvs.gnucash.org
Tue May 8 17:03:49 EDT 2007


Author: cstim
Date: 2007-05-08 17:03:48 -0400 (Tue, 08 May 2007)
New Revision: 16066
Trac: http://svn.gnucash.org/trac/changeset/16066

Modified:
   gnucash/trunk/src/core-utils/gnc-gconf-utils.c
   gnucash/trunk/src/gnome-utils/window-main-summarybar.c
Log:
Fix small memory leak - unfreed string.

Modified: gnucash/trunk/src/core-utils/gnc-gconf-utils.c
===================================================================
--- gnucash/trunk/src/core-utils/gnc-gconf-utils.c	2007-05-08 20:45:13 UTC (rev 16065)
+++ gnucash/trunk/src/core-utils/gnc-gconf-utils.c	2007-05-08 21:03:48 UTC (rev 16066)
@@ -908,8 +908,8 @@
 
   key = gnc_gconf_make_schema_key(GCONF_GENERAL_REGISTER, "use_theme_colors");
   schema = gconf_client_get_schema(our_client, key, &err);
+  g_free(key);
   if (schema == NULL) {
-    g_free(key);
     return FALSE;
   }
   gconf_schema_free(schema);

Modified: gnucash/trunk/src/gnome-utils/window-main-summarybar.c
===================================================================
--- gnucash/trunk/src/gnome-utils/window-main-summarybar.c	2007-05-08 20:45:13 UTC (rev 16065)
+++ gnucash/trunk/src/gnome-utils/window-main-summarybar.c	2007-05-08 21:03:48 UTC (rev 16066)
@@ -397,7 +397,7 @@
     gtk_combo_box_set_model(GTK_COMBO_BOX(summary->totals_combo), NULL);
     gtk_list_store_clear(summary->datamodel);
     for (current = g_list_first(currency_list); current; current = g_list_next(current)) {
-      const char *mnemonic;
+      const char *mnemonic, *total_mode_label;
 
       currency_accum = current->data;
 
@@ -420,13 +420,15 @@
                        gnc_commodity_print_info(currency_accum->currency, TRUE));
 
       gtk_list_store_append(summary->datamodel, &iter);
+      total_mode_label = get_total_mode_label(mnemonic, currency_accum->total_mode);
       gtk_list_store_set(summary->datamodel, &iter,
-                         COLUMN_MNEMONIC_TYPE, get_total_mode_label(mnemonic, currency_accum->total_mode),
+                         COLUMN_MNEMONIC_TYPE, total_mode_label,
                          COLUMN_ASSETS,        _("Assets:"),
                          COLUMN_ASSETS_VALUE,  asset_amount_string,
                          COLUMN_PROFITS,       _("Profits:"),
                          COLUMN_PROFITS_VALUE, profit_amount_string,
                          -1);
+      g_free(total_mode_label);
     }
     gtk_combo_box_set_model(GTK_COMBO_BOX(summary->totals_combo),
 			    GTK_TREE_MODEL(summary->datamodel));



More information about the gnucash-changes mailing list