summaryrefslogtreecommitdiff
path: root/util/i915tool
diff options
context:
space:
mode:
authorDaniele Forsi <dforsi@gmail.com>2014-07-27 18:45:30 +0200
committerPatrick Georgi <patrick@georgi-clan.de>2014-07-30 13:16:53 +0200
commit201093ef6d24de27bc491947b9ab31d22f0aca8f (patch)
tree889f80450e406907076945f71d51c58a1ceb507a /util/i915tool
parent06b13a37f0f4b3545b899e3488762b3ed9c20812 (diff)
downloadcoreboot-201093ef6d24de27bc491947b9ab31d22f0aca8f.tar.xz
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>
Diffstat (limited to 'util/i915tool')
-rw-r--r--util/i915tool/main.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/util/i915tool/main.c b/util/i915tool/main.c
index cb828e1da3..a0b4dec179 100644
--- a/util/i915tool/main.c
+++ b/util/i915tool/main.c
@@ -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 */