Skip to content

Commit 2f8d89d

Browse files
committed
mate-dictionary: Fix memory leak
1 parent d541d6e commit 2f8d89d

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

mate-dictionary/src/gdict-pref-dialog.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -459,19 +459,22 @@ static void
459459
font_button_font_set_cb (GtkWidget *font_button,
460460
GdictPrefDialog *dialog)
461461
{
462-
const char *font;
462+
gchar *font;
463463

464464
font = gtk_font_chooser_get_font (GTK_FONT_CHOOSER (font_button));
465-
if (!font || font[0] == '\0')
466-
return;
467465

468-
if (g_strcmp0 (dialog->print_font, font) == 0)
469-
return;
470-
466+
if (!font || font[0] == '\0' || g_strcmp0 (dialog->print_font, font) == 0)
467+
{
468+
g_free (font);
469+
return;
470+
}
471+
471472
g_free (dialog->print_font);
472473
dialog->print_font = g_strdup (font);
473474

474475
g_settings_set_string (dialog->settings, GDICT_SETTINGS_PRINT_FONT_KEY, dialog->print_font);
476+
477+
g_free (font);
475478
}
476479

477480
static void

0 commit comments

Comments
 (0)