From 853ce8c548904bf209dde6e53870fa771aa65879 Mon Sep 17 00:00:00 2001 From: Charalampos Kardaris Date: Wed, 4 Dec 2019 16:43:37 +0200 Subject: Fix on NULL param for m command and freeable pointers --- mktrayicon.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/mktrayicon.c b/mktrayicon.c index c1eb98d..caf3e85 100644 --- a/mktrayicon.c +++ b/mktrayicon.c @@ -323,8 +323,10 @@ gpointer watch_fifo(gpointer argv) } menusize = 0; - - if (param != NULL && *param == '\0') { + + if(!param) + break; + else if (*param == '\0') { #ifdef DEBUG printf("Removing onmenu handler\n"); #endif @@ -389,7 +391,8 @@ gpointer watch_fifo(gpointer argv) } else { //this is a label-only entry onmenu[item].name = save_word(param, i, last); - onmenu[item].action = "\0"; + onmenu[item].action = malloc(1); // pointer has to be freeable + onmenu[item].action = '\0'; } last = i; lastFound = '|'; @@ -402,7 +405,8 @@ gpointer watch_fifo(gpointer argv) } else{ onmenu[item].name = save_word(param, len, last); - onmenu[item].action = "\0"; + onmenu[item].action = malloc(1); + onmenu[item].action = '\0'; } } -- cgit