Merge branch 'tracing/core' of git://git.kernel.org/pub/scm/linux/kernel/git/frederic...
[linux-2.6-block.git] / fs / btrfs / relocation.c
index a9728680eca8ed299deb7fc322be97deeeb6f51b..ab7ab53187452aa7794bfcdfb5596385d3cc77b2 100644 (file)
@@ -3281,8 +3281,10 @@ static noinline_for_stack int relocate_block_group(struct reloc_control *rc)
                return -ENOMEM;
 
        path = btrfs_alloc_path();
-       if (!path)
+       if (!path) {
+               kfree(cluster);
                return -ENOMEM;
+       }
 
        rc->extents_found = 0;
        rc->extents_skipped = 0;
@@ -3762,7 +3764,8 @@ out:
                                       BTRFS_DATA_RELOC_TREE_OBJECTID);
                if (IS_ERR(fs_root))
                        err = PTR_ERR(fs_root);
-               btrfs_orphan_cleanup(fs_root);
+               else
+                       btrfs_orphan_cleanup(fs_root);
        }
        return err;
 }