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>
This commit is contained in:
Daniele Forsi 2014-07-27 12:01:40 +02:00 committed by Patrick Georgi
parent b532b12b41
commit 8e89847af4
1 changed files with 1 additions and 0 deletions

View File

@ -134,6 +134,7 @@ int parse_elf_to_stage(const struct buffer *input, struct buffer *output,
ERROR("Underflow copying out the segment." ERROR("Underflow copying out the segment."
"File has %zu bytes left, segment end is %zu\n", "File has %zu bytes left, segment end is %zu\n",
input->size, (size_t)(phdr[i].p_offset + phdr[i].p_filesz)); input->size, (size_t)(phdr[i].p_offset + phdr[i].p_filesz));
free(buffer);
return -1; return -1;
} }
memcpy(buffer + (l_start - data_start), memcpy(buffer + (l_start - data_start),