aboutsummaryrefslogtreecommitdiff
path: root/swaynag
diff options
context:
space:
mode:
Diffstat (limited to 'swaynag')
-rw-r--r--swaynag/config.c3
-rw-r--r--swaynag/swaynag.c3
2 files changed, 4 insertions, 2 deletions
diff --git a/swaynag/config.c b/swaynag/config.c
index 60bda3e0..b4c22443 100644
--- a/swaynag/config.c
+++ b/swaynag/config.c
@@ -365,11 +365,12 @@ int swaynag_load_config(char *path, struct swaynag *swaynag, list_t *types) {
}
free(name);
} else {
- char flag[nread + 3];
+ char *flag = malloc(sizeof(char) * (nread + 3));
sprintf(flag, "--%s", line);
char *argv[] = {"swaynag", flag};
result = swaynag_parse_options(2, argv, swaynag, types, type,
NULL, NULL);
+ free(flag);
if (result != 0) {
break;
}
diff --git a/swaynag/swaynag.c b/swaynag/swaynag.c
index 674c24b5..ceb795a8 100644
--- a/swaynag/swaynag.c
+++ b/swaynag/swaynag.c
@@ -28,9 +28,10 @@ static bool terminal_execute(char *terminal, char *command) {
fprintf(tmp, "#!/bin/sh\nrm %s\n%s", fname, command);
fclose(tmp);
chmod(fname, S_IRUSR | S_IWUSR | S_IXUSR);
- char cmd[strlen(terminal) + strlen(" -e ") + strlen(fname) + 1];
+ char *cmd = malloc(sizeof(char) * (strlen(terminal) + strlen(" -e ") + strlen(fname) + 1));
sprintf(cmd, "%s -e %s", terminal, fname);
execl("/bin/sh", "/bin/sh", "-c", cmd, NULL);
+ free(cmd);
return true;
}