summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/cmd-load-buffer.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2018-07-31 13:06:44 +0000
committernicm <nicm@openbsd.org>2018-07-31 13:06:44 +0000
commitd8443b7bdc8c8eb843e4acf4ea5196b9429cde5a (patch)
treefb28567d422c2fadb1520a4b688d7a3ba7b4e418 /usr.bin/tmux/cmd-load-buffer.c
parentStop reversing bytes read from the framebuffer. That was added since (diff)
downloadwireguard-openbsd-d8443b7bdc8c8eb843e4acf4ea5196b9429cde5a.tar.xz
wireguard-openbsd-d8443b7bdc8c8eb843e4acf4ea5196b9429cde5a.zip
Do not leak path or use it after free.
Diffstat (limited to 'usr.bin/tmux/cmd-load-buffer.c')
-rw-r--r--usr.bin/tmux/cmd-load-buffer.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.bin/tmux/cmd-load-buffer.c b/usr.bin/tmux/cmd-load-buffer.c
index f89d4691d46..5309dc8925d 100644
--- a/usr.bin/tmux/cmd-load-buffer.c
+++ b/usr.bin/tmux/cmd-load-buffer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-load-buffer.c,v 1.52 2018/07/11 08:29:21 nicm Exp $ */
+/* $OpenBSD: cmd-load-buffer.c,v 1.53 2018/07/31 13:06:44 nicm Exp $ */
/*
* Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org>
@@ -85,7 +85,7 @@ cmd_load_buffer_exec(struct cmd *self, struct cmdq_item *item)
error = server_set_stdin_callback(c, cmd_load_buffer_callback,
cdata, &cause);
if (error != 0) {
- cmdq_error(item, "%s: %s", path, cause);
+ cmdq_error(item, "-: %s", cause);
free(cause);
return (CMD_RETURN_ERROR);
}
@@ -93,6 +93,8 @@ cmd_load_buffer_exec(struct cmd *self, struct cmdq_item *item)
}
file = server_client_get_path(c, path);
+ free(path);
+
f = fopen(file, "rb");
if (f == NULL) {
cmdq_error(item, "%s: %s", file, strerror(errno));