file: fix ub for unknown opening modes

This commit is contained in:
rr- 2021-11-04 15:40:00 +01:00 committed by Marcin Kurczewski
parent df74117175
commit 10066506aa

View file

@ -20,6 +20,9 @@ MYFILE *FileOpen(const char *path, FILE_OPEN_MODE mode)
case FILE_OPEN_READ:
file->fp = fopen(path, "rb");
break;
default:
file->fp = NULL;
break;
}
if (!file->fp) {
free(file);