diff --git a/fs/vfs/ramfs.c b/fs/vfs/ramfs.c index 42d9b3a..228c3ab 100644 --- a/fs/vfs/ramfs.c +++ b/fs/vfs/ramfs.c @@ -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; }