Skip to content

Commit

Permalink
mate-dictionary: Fix memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
sc0w committed Sep 24, 2018
1 parent d541d6e commit 2f8d89d
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions mate-dictionary/src/gdict-pref-dialog.c
Expand Up @@ -459,19 +459,22 @@ static void
font_button_font_set_cb (GtkWidget *font_button,
GdictPrefDialog *dialog)
{
const char *font;
gchar *font;

font = gtk_font_chooser_get_font (GTK_FONT_CHOOSER (font_button));
if (!font || font[0] == '\0')
return;

if (g_strcmp0 (dialog->print_font, font) == 0)
return;

if (!font || font[0] == '\0' || g_strcmp0 (dialog->print_font, font) == 0)
{
g_free (font);
return;
}

g_free (dialog->print_font);
dialog->print_font = g_strdup (font);

g_settings_set_string (dialog->settings, GDICT_SETTINGS_PRINT_FONT_KEY, dialog->print_font);

g_free (font);
}

static void
Expand Down

0 comments on commit 2f8d89d

Please sign in to comment.