Patchwork ext4: add a kfree() on error i add_new_gdb()

login
register
mail settings
Submitter Dan Carpenter
Date July 30, 2011, 8:25 a.m.
Message ID <20110730082557.GB5575@shale.localdomain>
Download mbox | patch
Permalink /patch/107484/
State Accepted
Headers show

Comments

Dan Carpenter - July 30, 2011, 8:25 a.m.
We added some more error handling in b40971426a "ext4: add error
checking to calls to ext4_handle_dirty_metadata()".  But we need to
call kfree() as well to avoid a memory leak.

Signed-off-by: Dan Carpenter <error27@gmail.com>

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Theodore Ts'o - July 30, 2011, 4:59 p.m.
On Sat, Jul 30, 2011 at 11:25:57AM +0300, Dan Carpenter wrote:
> We added some more error handling in b40971426a "ext4: add error
> checking to calls to ext4_handle_dirty_metadata()".  But we need to
> call kfree() as well to avoid a memory leak.
> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>

Added to the ext4 tree, thanks for catching this!!

      	     	  	       	   	    - Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
index 6e3327d..71085df 100644
--- a/fs/ext4/resize.c
+++ b/fs/ext4/resize.c
@@ -517,6 +517,7 @@  static int add_new_gdb(handle_t *handle, struct inode *inode,
 	return err;
 
 exit_inode:
+	kfree(n_group_desc);
 	/* ext4_handle_release_buffer(handle, iloc.bh); */
 	brelse(iloc.bh);
 exit_dindj: