diff options
author | Charalampos Kardaris <ckardaris@outlook.com> | 2019-12-04 16:43:37 +0200 |
---|---|---|
committer | Charalampos Kardaris <ckardaris@outlook.com> | 2019-12-04 16:43:37 +0200 |
commit | 853ce8c548904bf209dde6e53870fa771aa65879 (patch) | |
tree | 8bd547ab069c69a8b28a64a1305019efbc4fdace /mktrayicon.c | |
parent | Fixed accepted format of parameter for command 'm' (diff) | |
download | mktrayicon-853ce8c548904bf209dde6e53870fa771aa65879.tar.gz mktrayicon-853ce8c548904bf209dde6e53870fa771aa65879.tar.bz2 mktrayicon-853ce8c548904bf209dde6e53870fa771aa65879.zip |
Fix on NULL param for m command and freeable pointers
Diffstat (limited to 'mktrayicon.c')
-rw-r--r-- | mktrayicon.c | 12 |
1 files 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'; } } |