diff options
author | nicm <nicm> | 2018-08-27 11:03:34 +0000 |
---|---|---|
committer | nicm <nicm> | 2018-08-27 11:03:34 +0000 |
commit | 79d2351ce8acbd579081e558cdbaebe333e10153 (patch) | |
tree | 3e9afa60f9b7a08d402eaf43eb773f0b3d604d6f /cmd-if-shell.c | |
parent | 1b4402c82369aa0bb93217979a8fd260a3f269cd (diff) | |
download | rtmux-79d2351ce8acbd579081e558cdbaebe333e10153.tar.gz rtmux-79d2351ce8acbd579081e558cdbaebe333e10153.tar.bz2 rtmux-79d2351ce8acbd579081e558cdbaebe333e10153.zip |
Memory leaks, from Gang Fan in GitHub issue 1453.
Diffstat (limited to 'cmd-if-shell.c')
-rw-r--r-- | cmd-if-shell.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/cmd-if-shell.c b/cmd-if-shell.c index ffdbe788..480912df 100644 --- a/cmd-if-shell.c +++ b/cmd-if-shell.c @@ -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')) |