aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Daniel Lockyer <thisisdaniellockyer@gmail.com>2016-04-29 16:16:47 +0100
committerLibravatar Daniel Lockyer <thisisdaniellockyer@gmail.com>2016-04-29 16:16:47 +0100
commit5a7099eee0b1c3eb343d26faacba0ac4b04c4367 (patch)
tree1ae07eea97645a40fcd54ef6d62ea32f7781b5f5
parentFix another -Wunused-result (diff)
downloadsway-5a7099eee0b1c3eb343d26faacba0ac4b04c4367.tar.gz
sway-5a7099eee0b1c3eb343d26faacba0ac4b04c4367.tar.zst
sway-5a7099eee0b1c3eb343d26faacba0ac4b04c4367.zip
sway/commands.c: add some free calls to release allocated memory
-rw-r--r--sway/commands.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sway/commands.c b/sway/commands.c
index 64cd0dc8..332d3888 100644
--- a/sway/commands.c
+++ b/sway/commands.c
@@ -245,6 +245,7 @@ static struct cmd_results *cmd_bindsym(int argc, char **argv) {
245 argv++; 245 argv++;
246 argc--; 246 argc--;
247 } else { 247 } else {
248 free_sway_binding(binding);
248 return cmd_results_new(CMD_FAILURE, "bindsym", 249 return cmd_results_new(CMD_FAILURE, "bindsym",
249 "Invalid bindsym command" 250 "Invalid bindsym command"
250 "(expected more than 2 arguments, got %d)", argc); 251 "(expected more than 2 arguments, got %d)", argc);
@@ -310,6 +311,7 @@ static struct cmd_results *cmd_bindcode(int argc, char **argv) {
310 argv++; 311 argv++;
311 argc--; 312 argc--;
312 } else { 313 } else {
314 free_sway_binding(binding);
313 return cmd_results_new(CMD_FAILURE, "bindcode", 315 return cmd_results_new(CMD_FAILURE, "bindcode",
314 "Invalid bindcode command" 316 "Invalid bindcode command"
315 "(expected more than 2 arguments, got %d)", argc); 317 "(expected more than 2 arguments, got %d)", argc);
@@ -531,6 +533,7 @@ static struct cmd_results *cmd_exec_always(int argc, char **argv) {
531 close(fd[1]); 533 close(fd[1]);
532 _exit(0); // Close child process 534 _exit(0); // Close child process
533 } else if (pid < 0) { 535 } else if (pid < 0) {
536 free(child);
534 return cmd_results_new(CMD_FAILURE, "exec_always", "Command failed (sway could not fork)."); 537 return cmd_results_new(CMD_FAILURE, "exec_always", "Command failed (sway could not fork).");
535 } 538 }
536 close(fd[1]); // close write 539 close(fd[1]); // close write