From 8e89847af41656f82226e755f03fdcc178d3ef78 Mon Sep 17 00:00:00 2001 From: Daniele Forsi Date: Sun, 27 Jul 2014 12:01:40 +0200 Subject: [PATCH] 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 Reviewed-on: http://review.coreboot.org/6379 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel Reviewed-by: Edward O'Callaghan --- util/cbfstool/cbfs-mkstage.c | 1 + 1 file changed, 1 insertion(+) 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),