util/intelvbttool: Free file object on error path
Prevents a memory leak. Found-by: Coverity Scan #1396047 Signed-off-by: Jacob Garber <jgarber1@ualberta.ca> Change-Id: I4c72a17351d8afbe23302edfeeba74b17608aef2 Reviewed-on: https://review.coreboot.org/c/coreboot/+/32685 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Patrick Rudolph <siro@das-labor.org>
This commit is contained in:
parent
9bb0461fbd
commit
2be617b58b
|
@ -1028,8 +1028,10 @@ static int patch_vbios(struct fileobject *fo,
|
|||
if (old_vbt) {
|
||||
if (oh->vbt_offset + vbt_size(old_vbt) == fo->size) {
|
||||
/* Located at the end of file - reduce file size */
|
||||
if (fo->size < vbt_size(old_vbt))
|
||||
if (fo->size < vbt_size(old_vbt)) {
|
||||
free_fo(old_vbt);
|
||||
return 1;
|
||||
}
|
||||
fo = remalloc_fo(fo, fo->size - vbt_size(old_vbt));
|
||||
if (!fo) {
|
||||
printerr("Failed to allocate memory\n");
|
||||
|
|
Loading…
Reference in New Issue