Check null pointer before fclose (#586)
* Check null pointer before fclose, because fclose(NULL) will lead to undefined behavior * Update main.cpp Cast to one code style * Update main.cpp Remove redundant ==
This commit is contained in:
parent
cafe59d73c
commit
99555ef9e9
|
@ -70,7 +70,10 @@ int __cdecl wmain(int argc, wchar_t* argv[])
|
|||
fGotChar = GetChar(&wch);
|
||||
}
|
||||
|
||||
fclose(hFile);
|
||||
if (hFile)
|
||||
{
|
||||
fclose(hFile);
|
||||
}
|
||||
wprintf(L"Done.\r\n");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue