Fix memory leaks: All strings from gnc_gconf_get_string need to be freed.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@16076 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Christian Stimming
2007-05-12 19:36:39 +00:00
parent fdb7af4a6b
commit 12ec997301
3 changed files with 10 additions and 5 deletions

View File

@@ -66,7 +66,7 @@ lookup_start_date_option(const gchar *section,
const gchar *key_relative,
GDate *fy_end)
{
const gchar *choice;
gchar *choice;
time_t time;
int which;
@@ -77,6 +77,7 @@ lookup_start_date_option(const gchar *section,
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

View File

@@ -871,8 +871,8 @@ gnc_default_currency (void)
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 @@ gnc_default_report_currency (void)
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 ();

View File

@@ -623,7 +623,8 @@ gnc_prefs_font_button_gconf_cb (GtkFontButton *fb,
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 @@ gnc_prefs_connect_font_button (GtkFontButton *fb)
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 @@ gnc_prefs_entry_gconf_cb (GtkEntry *entry,
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);
}