summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/cmd-load-buffer.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2009-07-09 09:54:56 +0000
committernicm <nicm@openbsd.org>2009-07-09 09:54:56 +0000
commitf99460e0cf7acd86c24258bfa3e628874e505cda (patch)
tree0d3be7310b2fc6de2468377802109b2e04174278 /usr.bin/tmux/cmd-load-buffer.c
parentChange inserting and deleting lines inside the scroll region to properly clear (diff)
downloadwireguard-openbsd-f99460e0cf7acd86c24258bfa3e628874e505cda.tar.xz
wireguard-openbsd-f99460e0cf7acd86c24258bfa3e628874e505cda.zip
Don't leak FILE * on malloc failure. From ivoire at users dot sourceforge dot net.
Diffstat (limited to 'usr.bin/tmux/cmd-load-buffer.c')
-rw-r--r--usr.bin/tmux/cmd-load-buffer.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/usr.bin/tmux/cmd-load-buffer.c b/usr.bin/tmux/cmd-load-buffer.c
index 5ac0246cd13..672086f2eeb 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.1 2009/06/01 22:58:49 nicm Exp $ */
+/* $OpenBSD: cmd-load-buffer.c,v 1.2 2009/07/09 09:54:56 nicm Exp $ */
/*
* Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org>
@@ -78,6 +78,7 @@ cmd_load_buffer_exec(struct cmd *self, struct cmd_ctx *ctx)
*/
if ((buf = malloc(statbuf.st_size + 1)) == NULL) {
ctx->error(ctx, "malloc error: %s", strerror(errno));
+ fclose(f);
return (-1);
}