mirror of
https://github.com/swaywm/sway.git
synced 2024-12-29 00:16:22 +01:00
Merge pull request #614 from neosilky/memleak
sway/commands.c: add some free calls to release allocated memory
This commit is contained in:
commit
fb41371444
1 changed files with 3 additions and 0 deletions
|
@ -245,6 +245,7 @@ static struct cmd_results *cmd_bindsym(int argc, char **argv) {
|
||||||
argv++;
|
argv++;
|
||||||
argc--;
|
argc--;
|
||||||
} else {
|
} else {
|
||||||
|
free_sway_binding(binding);
|
||||||
return cmd_results_new(CMD_FAILURE, "bindsym",
|
return cmd_results_new(CMD_FAILURE, "bindsym",
|
||||||
"Invalid bindsym command"
|
"Invalid bindsym command"
|
||||||
"(expected more than 2 arguments, got %d)", argc);
|
"(expected more than 2 arguments, got %d)", argc);
|
||||||
|
@ -310,6 +311,7 @@ static struct cmd_results *cmd_bindcode(int argc, char **argv) {
|
||||||
argv++;
|
argv++;
|
||||||
argc--;
|
argc--;
|
||||||
} else {
|
} else {
|
||||||
|
free_sway_binding(binding);
|
||||||
return cmd_results_new(CMD_FAILURE, "bindcode",
|
return cmd_results_new(CMD_FAILURE, "bindcode",
|
||||||
"Invalid bindcode command"
|
"Invalid bindcode command"
|
||||||
"(expected more than 2 arguments, got %d)", argc);
|
"(expected more than 2 arguments, got %d)", argc);
|
||||||
|
@ -531,6 +533,7 @@ static struct cmd_results *cmd_exec_always(int argc, char **argv) {
|
||||||
close(fd[1]);
|
close(fd[1]);
|
||||||
_exit(0); // Close child process
|
_exit(0); // Close child process
|
||||||
} else if (pid < 0) {
|
} else if (pid < 0) {
|
||||||
|
free(child);
|
||||||
return cmd_results_new(CMD_FAILURE, "exec_always", "Command failed (sway could not fork).");
|
return cmd_results_new(CMD_FAILURE, "exec_always", "Command failed (sway could not fork).");
|
||||||
}
|
}
|
||||||
close(fd[1]); // close write
|
close(fd[1]); // close write
|
||||||
|
|
Loading…
Reference in a new issue