[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>
pull/1/head
Eygene Ryabinkin 2008-08-31 22:17:30 +04:00 committed by Michael Brown
parent 99251f5b32
commit 6de45ad4ae
1 changed files with 2 additions and 1 deletions

View File

@ -90,6 +90,7 @@ static int read_file ( const char *filename, void **buf, size_t *len ) {
return 0;
err:
if ( file )
fclose ( file );
return -1;
}