diff options
author | Drew DeVault <sir@cmpwn.com> | 2016-04-29 11:25:26 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2016-04-29 11:25:26 -0400 |
commit | fb41371444110949c54d5a60e917a0bb6fa9d366 (patch) | |
tree | 1ae07eea97645a40fcd54ef6d62ea32f7781b5f5 | |
parent | Fix another -Wunused-result (diff) | |
parent | sway/commands.c: add some free calls to release allocated memory (diff) | |
download | sway-fb41371444110949c54d5a60e917a0bb6fa9d366.tar.gz sway-fb41371444110949c54d5a60e917a0bb6fa9d366.tar.zst sway-fb41371444110949c54d5a60e917a0bb6fa9d366.zip |
Merge pull request #614 from neosilky/memleak
sway/commands.c: add some free calls to release allocated memory
-rw-r--r-- | sway/commands.c | 3 |
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 |