r16076 - gnucash/trunk/src - Fix memory leaks: All strings from gnc_gconf_get_string need to be freed.
Christian Stimming
cstim at cvs.gnucash.org
Sat May 12 15:36:41 EDT 2007
Author: cstim
Date: 2007-05-12 15:36:39 -0400 (Sat, 12 May 2007)
New Revision: 16076
Trac: http://svn.gnucash.org/trac/changeset/16076
Modified:
gnucash/trunk/src/app-utils/gnc-accounting-period.c
gnucash/trunk/src/app-utils/gnc-ui-util.c
gnucash/trunk/src/gnome-utils/dialog-preferences.c
Log:
Fix memory leaks: All strings from gnc_gconf_get_string need to be freed.
Modified: gnucash/trunk/src/app-utils/gnc-accounting-period.c
===================================================================
--- gnucash/trunk/src/app-utils/gnc-accounting-period.c 2007-05-12 19:12:02 UTC (rev 16075)
+++ gnucash/trunk/src/app-utils/gnc-accounting-period.c 2007-05-12 19:36:39 UTC (rev 16076)
@@ -66,7 +66,7 @@
const gchar *key_relative,
GDate *fy_end)
{
- const gchar *choice;
+ gchar *choice;
time_t time;
int which;
@@ -77,6 +77,7 @@
which = gnc_gconf_get_int(section, key_relative, NULL);
time = gnc_accounting_period_start_timet(which, fy_end, NULL);
}
+ g_free(choice);
/* we will need the balance of the last transaction before the start
date, so subtract 1 from start date */
/* CAS: we don't actually do what this comment says. I think that's
Modified: gnucash/trunk/src/app-utils/gnc-ui-util.c
===================================================================
--- gnucash/trunk/src/app-utils/gnc-ui-util.c 2007-05-12 19:12:02 UTC (rev 16075)
+++ gnucash/trunk/src/app-utils/gnc-ui-util.c 2007-05-12 19:36:39 UTC (rev 16076)
@@ -871,8 +871,8 @@
GNC_COMMODITY_NS_CURRENCY, mnemonic);
DEBUG("mnemonic %s, result %p", mnemonic, currency);
g_free(mnemonic);
- g_free(choice);
}
+ g_free(choice);
if (!currency)
currency = gnc_locale_default_currency ();
@@ -902,9 +902,9 @@
currency = gnc_commodity_table_lookup(gnc_get_current_commodities(),
GNC_COMMODITY_NS_CURRENCY, mnemonic);
DEBUG("mnemonic %s, result %p", mnemonic ? mnemonic : "(null)", currency);
- g_free(choice);
g_free(mnemonic);
}
+ g_free(choice);
if (!currency)
currency = gnc_locale_default_currency ();
Modified: gnucash/trunk/src/gnome-utils/dialog-preferences.c
===================================================================
--- gnucash/trunk/src/gnome-utils/dialog-preferences.c 2007-05-12 19:12:02 UTC (rev 16075)
+++ gnucash/trunk/src/gnome-utils/dialog-preferences.c 2007-05-12 19:36:39 UTC (rev 16076)
@@ -623,7 +623,8 @@
static void
gnc_prefs_connect_font_button (GtkFontButton *fb)
{
- const gchar *name, *font;
+ const gchar *name;
+ gchar *font;
g_return_if_fail(GTK_IS_FONT_BUTTON(fb));
@@ -633,6 +634,7 @@
gtk_font_button_set_font_name(fb, font);
DEBUG(" font_button %s set", name);
+ g_free(font);
g_signal_connect(G_OBJECT(fb), "font_set",
G_CALLBACK(gnc_prefs_font_button_user_cb), NULL);
@@ -1138,13 +1140,15 @@
static void
gnc_prefs_connect_entry (GtkEntry *entry)
{
- const gchar *name, *text;
+ const gchar *name;
+ gchar *text;
g_return_if_fail(GTK_IS_ENTRY(entry));
name = gtk_widget_get_name(GTK_WIDGET(entry)) + PREFIX_LEN;
text = gnc_gconf_get_string(name, NULL, NULL);
gtk_entry_set_text(GTK_ENTRY(entry), text ? text : "");
DEBUG(" Entry %s set to '%s'", name?name:"(null)", text?text:"(null)");
+ g_free(text);
g_signal_connect(G_OBJECT(entry), "changed",
G_CALLBACK(gnc_prefs_entry_user_cb), NULL);
}
More information about the gnucash-changes
mailing list