file: cleanfile null vnode protection

This commit is contained in:
Matheus
2023-05-29 10:48:04 -03:00
parent 1c93fd89e2
commit 74924c4d11
+4 -2
View File
@@ -33,8 +33,10 @@ static file_t* newfile() {
}
static void cleanfile(file_t *file) {
vfs_close(file->vnode, fileflagstovnodeflags(file->flags));
VOP_RELEASE(file->vnode);
if (file->vnode) {
vfs_close(file->vnode, fileflagstovnodeflags(file->flags));
VOP_RELEASE(file->vnode);
}
slab_free(filecache, file);
}