fclose properly, 0 on coreio_open fail

This commit is contained in:
Stefanos Kornilios Mitsis Poiitidis 2014-06-23 01:31:04 +03:00
parent 4084fd1ced
commit 0ae8e0ebc8
1 changed files with 6 additions and 1 deletions

View File

@ -191,6 +191,11 @@ core_file* core_fopen(const char* filename)
}
} else {
rv->f = fopen(filename, "rb");
if (!rv->f) {
delete rv;
return 0;
}
}
return (core_file*)rv;
@ -232,7 +237,7 @@ int core_fclose(core_file* fc)
CORE_FILE* f = (CORE_FILE*)fc;
if (f->f) {
fclose((FILE*)f);
fclose(f->f);
}
else {