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> Reviewed-on: http://review.coreboot.org/6559 Tested-by: build bot (Jenkins) Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com> Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:
parent
c5d179123d
commit
a65c21eeb5
|
@ -281,9 +281,11 @@ 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;
|
||||
|
|
Loading…
Reference in New Issue