diff options
author | David <petrodavi@gmail.com> | 2016-03-13 17:09:58 +0100 |
---|---|---|
committer | David <petrodavi@gmail.com> | 2016-03-13 17:09:58 +0100 |
commit | e43f3e95c0e4f518433f3d5f9f3f59658dae5699 (patch) | |
tree | ff21d44fde6a3c8caafd6e6fb4641c5c9e956b85 | |
parent | 098d84ef73dcdfa78254edc79664e5fcf3ded6b3 (diff) | |
download | profani-tty-e43f3e95c0e4f518433f3d5f9f3f59658dae5699.tar.gz |
fix possible free(NULL)
-rw-r--r-- | src/tray.c | 8 |
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"); } |