linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Fix leak in __btrfs_map_block error path
@ 2013-07-30 17:42 Dave Jones
  0 siblings, 0 replies; only message in thread
From: Dave Jones @ 2013-07-30 17:42 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Linux Kernel Development

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

Signed-off-by: Dave Jones <davej@redhat.com>

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 78b8717..6a0f52f 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -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;
 	}

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2013-07-30 17:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-30 17:42 Fix leak in __btrfs_map_block error path Dave Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).