ramfs: fix dirent refcount bug
Signed-off-by: Michael Shaw <m@michaelsshaw.com>
This commit is contained in:
parent
eb41b17fea
commit
1fc17e6d6e
1 changed files with 1 additions and 3 deletions
|
|
@ -44,13 +44,13 @@ int ramfs_create(u64 flags, fs_t **out)
|
|||
fs->root_dirent = root;
|
||||
root->type = S_IFDIR;
|
||||
root->fs = fs;
|
||||
inode_inc_ref(root_inode);
|
||||
root->inode = root_inode;
|
||||
|
||||
*out = fs;
|
||||
return 0;
|
||||
|
||||
out_root_inode:
|
||||
inode_dec_ref_lock(root_inode);
|
||||
dirent_free(root);
|
||||
out_root:
|
||||
kfree(fs);
|
||||
|
|
@ -153,12 +153,10 @@ static int link(dirent_t *in, inode_t *to, const char *name, dirent_t **out)
|
|||
return -ENOMEM;
|
||||
}
|
||||
|
||||
inode_inc_ref(to);
|
||||
new->inode = to;
|
||||
new->fs = in->fs;
|
||||
|
||||
if (!list_insert(&in->inode->dirents, new)) {
|
||||
inode_dec_ref_lock(to);
|
||||
dirent_free(new);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue