Btrfs: add missing error handling to read_tree_block
authorFilipe David Borba Manana <fdmanana@gmail.com>
Tue, 30 Jul 2013 23:39:56 +0000 (00:39 +0100)
committerChris Mason <chris.mason@fusionio.com>
Sun, 1 Sep 2013 12:04:46 +0000 (08:04 -0400)
Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
fs/btrfs/disk-io.c

index 1356435..2a378ab 100644 (file)
@@ -1149,6 +1149,10 @@ struct extent_buffer *read_tree_block(struct btrfs_root *root, u64 bytenr,
                return NULL;
 
        ret = btree_read_extent_buffer_pages(root, buf, 0, parent_transid);
+       if (ret) {
+               free_extent_buffer(buf);
+               return NULL;
+       }
        return buf;
 
 }