Patrick Georgi (patrick@georgi-clan.de) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/6559
-gerrit
commit fc63761e7e73a8e411e0fe30da1f7d4147d8912a Author: Patrick Georgi patrick@georgi-clan.de Date: Sat Aug 9 16:58:00 2014 +0200
cbfstool: free stale memory
The process probably terminates not much later, but in case anyone reuses the function in something with longer life-time, free unused resources.
Change-Id: I10c471ee3d9dc9a3ebf08fe4605f223ea59b990e Found-by: Coverity Scan Signed-off-by: Patrick Georgi patrick@georgi-clan.de --- util/cbfstool/elfheaders.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/util/cbfstool/elfheaders.c b/util/cbfstool/elfheaders.c index 5b5cf94..71d34a9 100644 --- a/util/cbfstool/elfheaders.c +++ b/util/cbfstool/elfheaders.c @@ -281,8 +281,10 @@ phdr_read(const struct buffer *in, struct parsed_elf *pelf,
/* Ensure the contents are valid within the elf file. */ if (check_size(in, phdr[i].p_offset, phdr[i].p_filesz, - "segment contents")) + "segment contents")) { + free(phdr); return -1; + } }
pelf->phdr = phdr; @@ -422,6 +424,7 @@ static int strtab_read(const struct buffer *in, struct parsed_elf *pelf) buffer_splice(b, in, shdr->sh_offset, shdr->sh_size); if (check_size(in, shdr->sh_offset, buffer_size(b), "strtab")) { ERROR("STRTAB section not within bounds: %d\n", i); + free(b); return -1; } pelf->strtabs[i] = b;