Btrfs: fix possible memory leak in find_parent_nodes()
authorWang Shilong <wangsl.fnst@cn.fujitsu.com>
Thu, 8 Aug 2013 05:04:17 +0000 (13:04 +0800)
committerChris Mason <chris.mason@fusionio.com>
Sun, 1 Sep 2013 12:04:56 +0000 (08:04 -0400)
Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Reviewed-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
fs/btrfs/backref.c

index 980e85a264c045359fe679323bd3a626b49db748..ae798c1d088b55f21e9e9fbd1b5f94d81ae58662 100644 (file)
@@ -911,7 +911,6 @@ again:
 
        while (!list_empty(&prefs)) {
                ref = list_first_entry(&prefs, struct __prelim_ref, list);
-               list_del(&ref->list);
                WARN_ON(ref->count < 0);
                if (ref->count && ref->root_id && ref->parent == 0) {
                        /* no parent == root of tree */
@@ -956,6 +955,7 @@ again:
                                eie->next = ref->inode_list;
                        }
                }
+               list_del(&ref->list);
                kfree(ref);
        }