wutdevoptab: Fix memory leak in open()

This commit is contained in:
Maschell
2022-08-09 12:01:07 +02:00
committed by fincs
parent 366f02606b
commit 95feb9288a

View File

@@ -82,12 +82,14 @@ __wut_fs_open(struct _reent *r,
return -1;
}
} else if (failIfFileNotFound) { // Return an error if we don't we create new files
free(fixedPath);
r->_errno = __wut_fs_translate_error(status);
return -1;
}
} else if (status == FS_STATUS_OK) {
// If O_CREAT and O_EXCL are set, open() shall fail if the file exists.
if ((flags & (O_EXCL | O_CREAT)) == (O_EXCL | O_CREAT)) {
free(fixedPath);
r->_errno = EEXIST;
return -1;
}