summaryrefslogtreecommitdiff
path: root/util/cbfstool
diff options
context:
space:
mode:
authorDaniele Forsi <dforsi@gmail.com>2014-07-27 12:01:40 +0200
committerPatrick Georgi <patrick@georgi-clan.de>2014-07-30 10:36:00 +0200
commit8e89847af41656f82226e755f03fdcc178d3ef78 (patch)
tree5c52c63cbf0503d24c478894f59feddb6d12c016 /util/cbfstool
parentb532b12b411d315b7799fc00a987bf21deb7e8a3 (diff)
downloadcoreboot-8e89847af41656f82226e755f03fdcc178d3ef78.tar.xz
util/cbfstool: free buffer on error path
Fix memory leak found by scan-build from clang version 3.2-11. Change-Id: Id8f9db46cf42012a0eb0a632c9d83a4eec1989a2 Signed-off-by: Daniele Forsi <dforsi@gmail.com> Reviewed-on: http://review.coreboot.org/6379 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Diffstat (limited to 'util/cbfstool')
-rw-r--r--util/cbfstool/cbfs-mkstage.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/util/cbfstool/cbfs-mkstage.c b/util/cbfstool/cbfs-mkstage.c
index 2a92c9fb5a..d795c7c0e2 100644
--- a/util/cbfstool/cbfs-mkstage.c
+++ b/util/cbfstool/cbfs-mkstage.c
@@ -134,6 +134,7 @@ int parse_elf_to_stage(const struct buffer *input, struct buffer *output,
ERROR("Underflow copying out the segment."
"File has %zu bytes left, segment end is %zu\n",
input->size, (size_t)(phdr[i].p_offset + phdr[i].p_filesz));
+ free(buffer);
return -1;
}
memcpy(buffer + (l_start - data_start),