util/i915tool: close the file also when fread() returned an error
Change-Id: I92f816aa1351a295287ebbcc78665ac87c318c23 Signed-off-by: Daniele Forsi <dforsi@gmail.com> Reviewed-on: http://review.coreboot.org/6386 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Patrick Georgi <patrick@georgi-clan.de> Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
This commit is contained in:
parent
06b13a37f0
commit
201093ef6d
|
@ -227,13 +227,13 @@ int main(int argc, char *argv[])
|
|||
bios_image = malloc(8*1048576);
|
||||
fd = fopen(argv[0], "r");
|
||||
amt = fread(bios_image, 65536, 128, fd);
|
||||
fclose(fd);
|
||||
if (amt < 1) {
|
||||
free(bios_image);
|
||||
} else {
|
||||
i915->bios_bin = bios_image;
|
||||
i915->dev_private->opregion.vbt = bios_image;
|
||||
bios_image_size = amt * 65536;
|
||||
fclose(fd);
|
||||
}
|
||||
}
|
||||
/* get the base address for the mmio indirection registers -- BAR 2 */
|
||||
|
|
Loading…
Reference in New Issue