summaryrefslogtreecommitdiffstats
path: root/cmd-load-buffer.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2009-07-09 18:05:17 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2009-07-09 18:05:17 +0000
commit4422b958c321596f463f1de74732418e88965134 (patch)
treef86e7fcdc41cd7c81e3800fed43c5a481215eb85 /cmd-load-buffer.c
parent295879cced7fc430c751b6d3b2c9d7d253cb0dc0 (diff)
Don't leak FILE * on malloc failure. From ivoire at users dot sourceforge dot
net.
Diffstat (limited to 'cmd-load-buffer.c')
-rw-r--r--cmd-load-buffer.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/cmd-load-buffer.c b/cmd-load-buffer.c
index 1be567ec..672086f2 100644
--- a/cmd-load-buffer.c
+++ b/cmd-load-buffer.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-load-buffer.c,v 1.4 2009-05-21 19:38:51 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);
}