summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/cmd-run-shell.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2018-08-27 11:03:34 +0000
committernicm <nicm@openbsd.org>2018-08-27 11:03:34 +0000
commit04131cda78bf4f4e764861e37f7c720ef6fa30f2 (patch)
tree0229d8955be66eb1c3055bd453c99fc5fb3265fb /usr.bin/tmux/cmd-run-shell.c
parentompinmux has been replaced by pinctrl (diff)
downloadwireguard-openbsd-04131cda78bf4f4e764861e37f7c720ef6fa30f2.tar.xz
wireguard-openbsd-04131cda78bf4f4e764861e37f7c720ef6fa30f2.zip
Memory leaks, from Gang Fan in GitHub issue 1453.
Diffstat (limited to 'usr.bin/tmux/cmd-run-shell.c')
-rw-r--r--usr.bin/tmux/cmd-run-shell.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/usr.bin/tmux/cmd-run-shell.c b/usr.bin/tmux/cmd-run-shell.c
index a37ae46bace..cbb4a888cc9 100644
--- a/usr.bin/tmux/cmd-run-shell.c
+++ b/usr.bin/tmux/cmd-run-shell.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-run-shell.c,v 1.54 2018/08/23 15:45:05 nicm Exp $ */
+/* $OpenBSD: cmd-run-shell.c,v 1.55 2018/08/27 11:03:34 nicm Exp $ */
/*
* Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org>
@@ -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);