提交 a4fdb61e 编写于 作者: W Wang Shilong 提交者: Chris Mason

Btrfs: fix possible memory leak in find_parent_nodes()

Signed-off-by: NWang Shilong <wangsl.fnst@cn.fujitsu.com>
Reviewed-by: NMiao Xie <miaox@cn.fujitsu.com>
Signed-off-by: NJosef Bacik <jbacik@fusionio.com>
Signed-off-by: NChris Mason <chris.mason@fusionio.com>
上级 09fb99a6
...@@ -911,7 +911,6 @@ static int find_parent_nodes(struct btrfs_trans_handle *trans, ...@@ -911,7 +911,6 @@ static int find_parent_nodes(struct btrfs_trans_handle *trans,
while (!list_empty(&prefs)) { while (!list_empty(&prefs)) {
ref = list_first_entry(&prefs, struct __prelim_ref, list); ref = list_first_entry(&prefs, struct __prelim_ref, list);
list_del(&ref->list);
WARN_ON(ref->count < 0); WARN_ON(ref->count < 0);
if (ref->count && ref->root_id && ref->parent == 0) { if (ref->count && ref->root_id && ref->parent == 0) {
/* no parent == root of tree */ /* no parent == root of tree */
...@@ -956,6 +955,7 @@ static int find_parent_nodes(struct btrfs_trans_handle *trans, ...@@ -956,6 +955,7 @@ static int find_parent_nodes(struct btrfs_trans_handle *trans,
eie->next = ref->inode_list; eie->next = ref->inode_list;
} }
} }
list_del(&ref->list);
kfree(ref); kfree(ref);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册