Commit a4fdb61e authored by Wang Shilong's avatar Wang Shilong Committed by Chris Mason

Btrfs: fix possible memory leak in find_parent_nodes()

Signed-off-by: default avatarWang Shilong <wangsl.fnst@cn.fujitsu.com>
Reviewed-by: default avatarMiao Xie <miaox@cn.fujitsu.com>
Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
Signed-off-by: default avatarChris Mason <chris.mason@fusionio.com>
parent 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%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment