Fix dereference after null check, CID 1570976

This commit is contained in:
olszomal
2023-11-13 14:54:59 +01:00
committed by Michał Trojnara
parent 6d6270094e
commit 6f4e9ab597

View File

@ -3653,11 +3653,13 @@ static int use_legacy(void)
static int file_exists(const char *filename) static int file_exists(const char *filename)
{ {
if (filename) {
FILE *file = fopen(filename, "rb"); FILE *file = fopen(filename, "rb");
if (file) { if (file) {
fclose(file); fclose(file);
return 1; /* File exists */ return 1; /* File exists */
} }
}
return 0; /* File does not exist */ return 0; /* File does not exist */
} }