2009-05-14 18:37:49

by Manish Katiyar

[permalink] [raw]
Subject: [PATCH] ext4: Fix memory leak in ext4_fill_super()

We forget to free up the space allocated for s_blockgroup_lock in case
of failed mounts.
Below patch fixes up the memory leak.

Signed-off-by: Manish Katiyar <[email protected]>
---
fs/ext4/super.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 2958f4e..fdc1e12 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -2862,6 +2862,7 @@ failed_mount:
brelse(bh);
out_fail:
sb->s_fs_info = NULL;
+ kfree(sbi->s_blockgroup_lock);
kfree(sbi);
lock_kernel();
return ret;
--
1.5.4.3


--
Thanks -
Manish


2009-05-18 04:09:40

by Theodore Ts'o

[permalink] [raw]
Subject: Re: [PATCH] ext4: Fix memory leak in ext4_fill_super()

On Fri, May 15, 2009 at 12:07:27AM +0530, Manish Katiyar wrote:
> We forget to free up the space allocated for s_blockgroup_lock in case
> of failed mounts.
> Below patch fixes up the memory leak.

Thanks, I've applied the ext2, ext3, and ext4 patches into the patch
queue for submission to Linus at the next merge window.

- Ted