[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1262797042-24179-1-git-send-email-jslaby@suse.cz>
Date: Wed, 6 Jan 2010 17:57:22 +0100
From: Jiri Slaby <jslaby@...e.cz>
To: chris.mason@...cle.com
Cc: viro@...iv.linux.org.uk, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org, jirislaby@...il.com,
linux-btrfs@...r.kernel.org
Subject: [PATCH 1/1] FS: btrfs, fix memory leaks
Stanse found 2 memory leaks in relocate_block_group and
__btrfs_map_block. cluster and multi are not freed/assigned on all
paths. Fix that.
Signed-off-by: Jiri Slaby <jslaby@...e.cz>
Cc: Chris Mason <chris.mason@...cle.com>
Cc: linux-btrfs@...r.kernel.org
---
fs/btrfs/relocation.c | 4 +++-
fs/btrfs/volumes.c | 4 +++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index cfcc93c..4565f5b 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -3274,8 +3274,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;
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 7eda483..8555028 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -2649,8 +2649,10 @@ again:
em = lookup_extent_mapping(em_tree, logical, *length);
read_unlock(&em_tree->lock);
- if (!em && unplug_page)
+ if (!em && unplug_page) {
+ kfree(multi);
return 0;
+ }
if (!em) {
printk(KERN_CRIT "unable to find logical %llu len %llu\n",
--
1.6.5.7
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists