Btrfs: fix memory leak in do_walk_down
authorLiu Bo <bo.li.liu@oracle.com>
Wed, 14 Sep 2016 02:02:27 +0000 (19:02 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 6 Jan 2017 10:16:10 +0000 (11:16 +0100)
commit a958eab0ed7fdc1b977bc25d3af6efedaa945488 upstream.

The extent buffer 'next' needs to be free'd conditionally.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/btrfs/extent-tree.c

index 431364ab9c0eaa3b8379834930ae3908c238be20..099645ab986dd3d3b03e1aed414598290c8625fd 100644 (file)
@@ -8488,6 +8488,7 @@ static noinline int do_walk_down(struct btrfs_trans_handle *trans,
                                       &wc->flags[level - 1]);
        if (ret < 0) {
                btrfs_tree_unlock(next);
+               free_extent_buffer(next);
                return ret;
        }