mirror of https://github.com/PCSX2/pcsx2.git
pcsx2:cso: NULL pointer check
Coverity: CID 146846 (#1 of 1): Dereference after null check (FORWARD_NULL) 5. var_deref_model: Passing null pointer fp to fclose, which dereferences it
This commit is contained in:
parent
b9e00ab611
commit
4184d6eef5
|
@ -43,11 +43,13 @@ bool CsoFileReader::CanHandle(const wxString& fileName) {
|
|||
if (wxFileName::FileExists(fileName) && fileName.Lower().EndsWith(L".cso")) {
|
||||
FILE* fp = PX_fopen_rb(fileName);
|
||||
CsoHeader hdr;
|
||||
if (fp && fread(&hdr, 1, sizeof(hdr), fp) == sizeof(hdr)) {
|
||||
if (fp) {
|
||||
if (fread(&hdr, 1, sizeof(hdr), fp) == sizeof(hdr)) {
|
||||
supported = ValidateHeader(hdr);
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
}
|
||||
return supported;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue