[coreboot-gerrit] New patch to review for coreboot: fc06265 util/i915tool: close the file also when fread() returned an error

Daniele Forsi (dforsi@gmail.com) gerrit at coreboot.org
Sun Jul 27 20:57:45 CEST 2014


Daniele Forsi (dforsi at gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/6386

-gerrit

commit fc06265ab0197fb0d3f6187f639cbbd789cc295f
Author: Daniele Forsi <dforsi at gmail.com>
Date:   Sun Jul 27 18:45:30 2014 +0200

    util/i915tool: close the file also when fread() returned an error
    
    Change-Id: I92f816aa1351a295287ebbcc78665ac87c318c23
    Signed-off-by: Daniele Forsi <dforsi at gmail.com>
---
 util/i915tool/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/util/i915tool/main.c b/util/i915tool/main.c
index cb828e1..a0b4dec 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 */



More information about the coreboot-gerrit mailing list