summaryrefslogtreecommitdiffstats
path: root/cmd-run-shell.c
diff options
context:
space:
mode:
authornicm <nicm>2018-08-27 11:03:34 +0000
committernicm <nicm>2018-08-27 11:03:34 +0000
commit79d2351ce8acbd579081e558cdbaebe333e10153 (patch)
tree3e9afa60f9b7a08d402eaf43eb773f0b3d604d6f /cmd-run-shell.c
parent1b4402c82369aa0bb93217979a8fd260a3f269cd (diff)
Memory leaks, from Gang Fan in GitHub issue 1453.
Diffstat (limited to 'cmd-run-shell.c')
-rw-r--r--cmd-run-shell.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/cmd-run-shell.c b/cmd-run-shell.c
index ff12b5cd..47fceafe 100644
--- a/cmd-run-shell.c
+++ b/cmd-run-shell.c
@@ -102,8 +102,12 @@ cmd_run_shell_exec(struct cmd *self, struct cmdq_item *item)
if (!args_has(args, 'b'))
cdata->item = item;
- job_run(cdata->cmd, s, server_client_get_cwd(item->client, s), NULL,
- cmd_run_shell_callback, cmd_run_shell_free, cdata, 0);
+ if (job_run(cdata->cmd, s, server_client_get_cwd(item->client, s), NULL,
+ cmd_run_shell_callback, cmd_run_shell_free, cdata, 0) == NULL) {
+ cmdq_error(item, "failed to run command: %s", cdata->cmd);
+ free(cdata);
+ return (CMD_RETURN_ERROR);
+ }
if (args_has(args, 'b'))
return (CMD_RETURN_NORMAL);