Btrfs: fix possible memory leak in the find_parent_nodes()
authorWang Shilong <wangsl-fnst@cn.fujitsu.com>
Wed, 8 May 2013 08:10:25 +0000 (08:10 +0000)
committerJosef Bacik <jbacik@fusionio.com>
Sat, 18 May 2013 01:40:17 +0000 (21:40 -0400)
In the find_parent_nodes(), if read_tree_block() fails, we can
not return directly, we should free some allocated memory otherwise
memory leak happens.

Signed-off-by: Wang Shilong <wangsl-fnst@cn.fujitsu.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
fs/btrfs/backref.c

index b4fb41558111b75d461096d8acdfca34690b8728..290e347b6db3f925f414fd9be4e6ea394da6f887 100644 (file)
@@ -918,7 +918,8 @@ again:
                                                           ref->parent, bsz, 0);
                                if (!eb || !extent_buffer_uptodate(eb)) {
                                        free_extent_buffer(eb);
-                                       return -EIO;
+                                       ret = -EIO;
+                                       goto out;
                                }
                                ret = find_extent_in_eb(eb, bytenr,
                                                        *extent_item_pos, &eie);