summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/cmd-if-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-if-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-if-shell.c')
-rw-r--r--usr.bin/tmux/cmd-if-shell.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/usr.bin/tmux/cmd-if-shell.c b/usr.bin/tmux/cmd-if-shell.c
index 8715bdac282..4af22e0dd29 100644
--- a/usr.bin/tmux/cmd-if-shell.c
+++ b/usr.bin/tmux/cmd-if-shell.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-if-shell.c,v 1.59 2018/08/23 15:45:05 nicm Exp $ */
+/* $OpenBSD: cmd-if-shell.c,v 1.60 2018/08/27 11:03:34 nicm Exp $ */
/*
* Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org>
@@ -120,8 +120,13 @@ cmd_if_shell_exec(struct cmd *self, struct cmdq_item *item)
cdata->item = NULL;
memcpy(&cdata->mouse, &shared->mouse, sizeof cdata->mouse);
- job_run(shellcmd, s, server_client_get_cwd(item->client, s), NULL,
- cmd_if_shell_callback, cmd_if_shell_free, cdata, 0);
+ if (job_run(shellcmd, s, server_client_get_cwd(item->client, s), NULL,
+ cmd_if_shell_callback, cmd_if_shell_free, cdata, 0) == NULL) {
+ cmdq_error(item, "failed to run command: %s", shellcmd);
+ free(shellcmd);
+ free(cdata);
+ return (CMD_RETURN_ERROR);
+ }
free(shellcmd);
if (args_has(args, 'b'))