Skip to content

Commit

Permalink
[util] Avoid calling fclose(NULL) in zbin.c
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Eygene Ryabinkin authored and Michael Brown committed Sep 4, 2008
1 parent 99251f5 commit 6de45ad
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/util/zbin.c
Expand Up @@ -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;
}

Expand Down

0 comments on commit 6de45ad

Please sign in to comment.