Fix crash on uninitialized variable

The WRITE() macro checks if the "fw" pointer
is open upon fwrite() error. Since fw was
not initialized before use, it might crash for non-zero fw.

cppcheck reported.
[utils/jz4740_tools/HXFreplace.c:187]: (error) Uninitialized variable: fw

Change-Id: I558170f9f17828c9fd515a5da36ad8b5cb30a9ad
This commit is contained in:
Thomas Jarosch 2015-01-13 21:57:24 +01:00
parent 1212edd352
commit 2ee2a9697a

View file

@ -107,7 +107,7 @@ static int checksum(FILE *file)
int main(int argc, char *argv[])
{
FILE *infile, *outfile, *fw;
FILE *infile, *outfile, *fw = NULL;
fprintf(stderr, "HXFreplace v" VERSION " - (C) 2008 Maurus Cuelenaere\n");
fprintf(stderr, "This is free software; see the source for copying conditions. There is NO\n");