summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEygene Ryabinkin2008-08-31 20:17:30 +0200
committerMichael Brown2008-09-04 12:29:37 +0200
commit6de45ad4ae65d1754abaee4d5e92851b7b40c9b5 (patch)
tree60e06cadb331e70741d118914becb9c85bbc21c4
parent[libprefix] Add addr32 prefix required by older assemblers (diff)
downloadipxe-6de45ad4ae65d1754abaee4d5e92851b7b40c9b5.tar.gz
ipxe-6de45ad4ae65d1754abaee4d5e92851b7b40c9b5.tar.xz
ipxe-6de45ad4ae65d1754abaee4d5e92851b7b40c9b5.zip
[util] Avoid calling fclose(NULL) in zbin.c
Must check that argument to a fclose() is not NULL -- we can get to the 'err' label when file was not opened. fclose(NULL) is known to produce core dump on some platforms and we don't want zbin to fail so loudly. Signed-off-by: Eygene Ryabinkin <rea-fbsd@codelabs.ru>
-rw-r--r--src/util/zbin.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/util/zbin.c b/src/util/zbin.c
index f47fa36b..b24f401e 100644
--- a/src/util/zbin.c
+++ b/src/util/zbin.c
@@ -90,7 +90,8 @@ static int read_file ( const char *filename, void **buf, size_t *len ) {
return 0;
err:
- fclose ( file );
+ if ( file )
+ fclose ( file );
return -1;
}