Skip to contentSkip to conversation

Fix leak in __btrfs_map_block error path

PATCH Dave Jones 1 participant 1 message Jul 30, 2013 Btrfs file system

lore
Share & tools
lore

Dave Jones

author
#0 lore raw

If we bail out when the stripe alloc fails, we need to undo the earlier allocation of raid_map.

fs/btrfs/volumes.c +1 -0
index 78b8717..6a0f52f 100644
@@ -4671,6 +4671,7 @@ static int __btrfs_map_block(struct btrfs_fs_info *fs_info, int rw,
 	}
 	bbio = kzalloc(btrfs_bio_size(num_alloc_stripes), GFP_NOFS);
 	if (!bbio) {
+		kfree(raid_map);
 		ret = -ENOMEM;
 		goto out;
 	}