From ad945b9af41b644dbcc108931bee980d484e9eb7 Mon Sep 17 00:00:00 2001 From: Pavel Shlyak Date: Thu, 29 Aug 2019 13:37:30 +0300 Subject: geyes: avoid memory leak --- geyes/themes.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/geyes/themes.c b/geyes/themes.c index aebc8ee1..74878315 100644 --- a/geyes/themes.c +++ b/geyes/themes.c @@ -112,12 +112,11 @@ load_theme (EyesApplet *eyes_applet, const gchar *theme_dir) file_name = g_strdup_printf("%s%s",theme_dir,"/config"); theme_file = fopen (file_name, "r"); + g_free (file_name); if (theme_file == NULL) { g_free (eyes_applet->theme_dir); eyes_applet->theme_dir = g_strdup_printf (GEYES_THEMES_DIR "Default-tiny/"); - g_free (file_name); - file_name = g_strdup (GEYES_THEMES_DIR "Default-tiny/config"); - theme_file = fopen (file_name, "r"); + theme_file = fopen (GEYES_THEMES_DIR "Default-tiny/config", "r"); } /* if it's still NULL we've got a major problem */ @@ -155,8 +154,6 @@ load_theme (EyesApplet *eyes_applet, const gchar *theme_dir) eyes_applet->pupil_height = gdk_pixbuf_get_height (eyes_applet->pupil_image); eyes_applet->pupil_width = gdk_pixbuf_get_width (eyes_applet->pupil_image); - g_free (file_name); - return TRUE; } -- cgit v1.2.1