summaryrefslogtreecommitdiffstats
path: root/cmd-capture-pane.c
diff options
context:
space:
mode:
authornicm <nicm>2015-10-07 09:52:58 +0000
committernicm <nicm>2015-10-07 09:52:58 +0000
commit7340d5adfdc8cc6d845a373f3e0d59bfd10a45d1 (patch)
treead0be68020812afde2a6c638e4aeddbea91e1797 /cmd-capture-pane.c
parent695a591f8e9bce3fe3dd22a23a337f0fa548b543 (diff)
Couple of memory leaks in error paths, from Frederik Vanderstraeten.
Diffstat (limited to 'cmd-capture-pane.c')
-rw-r--r--cmd-capture-pane.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/cmd-capture-pane.c b/cmd-capture-pane.c
index a348e155..bd9ecebb 100644
--- a/cmd-capture-pane.c
+++ b/cmd-capture-pane.c
@@ -196,6 +196,7 @@ cmd_capture_pane_exec(struct cmd *self, struct cmd_q *cmdq)
if (c == NULL ||
(c->session != NULL && !(c->flags & CLIENT_CONTROL))) {
cmdq_error(cmdq, "can't write to stdout");
+ free(buf);
return (CMD_RETURN_ERROR);
}
evbuffer_add(c->stdout_data, buf, len);
@@ -210,11 +211,12 @@ cmd_capture_pane_exec(struct cmd *self, struct cmd_q *cmdq)
if (paste_set(buf, len, bufname, &cause) != 0) {
cmdq_error(cmdq, "%s", cause);
- free(buf);
free(cause);
+ free(buf);
return (CMD_RETURN_ERROR);
}
}
+ free(buf);
return (CMD_RETURN_NORMAL);
}