From 2ee2a9697a1cea6ca3b9fa328440b8f46aa84fd8 Mon Sep 17 00:00:00 2001 From: Thomas Jarosch Date: Tue, 13 Jan 2015 21:57:24 +0100 Subject: [PATCH] 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 --- utils/jz4740_tools/HXFreplace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/jz4740_tools/HXFreplace.c b/utils/jz4740_tools/HXFreplace.c index bcfff82540..5a05525194 100644 --- a/utils/jz4740_tools/HXFreplace.c +++ b/utils/jz4740_tools/HXFreplace.c @@ -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");