2
0
mirror of https://github.com/xcat2/xNBA.git synced 2024-11-26 03:09:12 +00:00

[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>
This commit is contained in:
Eygene Ryabinkin 2008-08-31 22:17:30 +04:00 committed by Michael Brown
parent 99251f5b32
commit 6de45ad4ae

View File

@ -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;
}