From 201093ef6d24de27bc491947b9ab31d22f0aca8f Mon Sep 17 00:00:00 2001 From: Daniele Forsi Date: Sun, 27 Jul 2014 18:45:30 +0200 Subject: util/i915tool: close the file also when fread() returned an error Change-Id: I92f816aa1351a295287ebbcc78665ac87c318c23 Signed-off-by: Daniele Forsi Reviewed-on: http://review.coreboot.org/6386 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel Reviewed-by: Patrick Georgi Reviewed-by: Edward O'Callaghan --- util/i915tool/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'util') 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 */ -- cgit v1.2.3