about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorDavid <petrodavi@gmail.com>2016-03-13 17:09:58 +0100
committerDavid <petrodavi@gmail.com>2016-03-13 17:09:58 +0100
commite43f3e95c0e4f518433f3d5f9f3f59658dae5699 (patch)
treeff21d44fde6a3c8caafd6e6fb4641c5c9e956b85
parent098d84ef73dcdfa78254edc79664e5fcf3ded6b3 (diff)
downloadprofani-tty-e43f3e95c0e4f518433f3d5f9f3f59658dae5699.tar.gz
fix possible free(NULL)
-rw-r--r--src/tray.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/tray.c b/src/tray.c
index 9bd45cf0..84936fa0 100644
--- a/src/tray.c
+++ b/src/tray.c
@@ -84,12 +84,16 @@ static void _get_icons(void)
         GString *name = g_string_new(g_dir_read_name(dir));
         while (name->len) {
             if (g_strcmp0("proIcon.png", name->str) == 0) {
-                g_string_free(icon_filename, true);
+                if (icon_filename) {
+                    g_string_free(icon_filename, true);
+                }
                 icon_filename = g_string_new(icons_dir->str);
                 g_string_append(icon_filename, "/proIcon.png");
             } else
             if (g_strcmp0("proIconMsg.png", name->str) == 0){
-                g_string_free(icon_msg_filename, true);
+                if (icon_filename) {
+                    g_string_free(icon_msg_filename, true);
+                }
                 icon_msg_filename = g_string_new(icons_dir->str);
                 g_string_append(icon_msg_filename, "/proIconMsg.png");
             }