aboutsummaryrefslogtreecommitdiff
path: root/sway
diff options
context:
space:
mode:
authorael-code <tommy.ael@gmail.com>2018-06-26 12:53:47 +0200
committerael-code <tommy.ael@gmail.com>2018-06-26 15:37:39 +0200
commit4550cb2b3e7e6b4242cf2a3e126b6f47bc8f2182 (patch)
treeddcd6b40ae89d26f79f2db4212fc9d6a5c2c3cac /sway
parentaf0f0375ef9aefb1d53e2058ec2f4cf51ee287a5 (diff)
fix memleak on background cmd error
- src must be free after join_args() - wordfree must bee used after wordexp
Diffstat (limited to 'sway')
-rw-r--r--sway/commands/output/background.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sway/commands/output/background.c b/sway/commands/output/background.c
index 82bccf68..4f422cec 100644
--- a/sway/commands/output/background.c
+++ b/sway/commands/output/background.c
@@ -62,8 +62,11 @@ struct cmd_results *output_cmd_background(int argc, char **argv) {
wordexp_t p;
char *src = join_args(argv, j);
if (wordexp(src, &p, 0) != 0 || p.we_wordv[0] == NULL) {
- return cmd_results_new(CMD_INVALID, "output",
- "Invalid syntax (%s).", src);
+ struct cmd_results *cmd_res = cmd_results_new(CMD_INVALID, "output",
+ "Invalid syntax (%s)", src);
+ free(src);
+ wordfree(&p);
+ return cmd_res;
}
free(src);
src = p.we_wordv[0];