public inbox for linux-raid@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] md: memory leak on error path in dm_exception_store_create()
@ 2009-07-19 11:46 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2009-07-19 11:46 UTC (permalink / raw)
  To: neilb; +Cc: linux-raid

tmp_store should  be freed if the persistent flag is invalid.

Compile tested only.  Sorry.  Found by smatch 
(http://repo.or.cz/w/smatch.git).

regards,
dan carpenter

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

--- orig/drivers/md/dm-exception-store.c	2009-07-17 14:11:10.000000000 +0300
+++ new/drivers/md/dm-exception-store.c	2009-07-17 14:13:24.000000000 +0300
@@ -217,13 +217,14 @@
 		type = get_type("N");
 	else {
 		ti->error = "Persistent flag is not P or N";
-		return -EINVAL;
+		r = -EINVAL;
+		goto out_free;
 	}
 
 	if (!type) {
 		ti->error = "Exception store type not recognised";
 		r = -EINVAL;
-		goto bad_type;
+		goto out_free;
 	}
 
 	tmp_store->type = type;
@@ -254,7 +255,7 @@
 	dm_put_device(ti, tmp_store->cow);
 bad_cow:
 	put_type(type);
-bad_type:
+out_free:
 	kfree(tmp_store);
 	return r;
 }

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

only message in thread, other threads:[~2009-07-19 11:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-19 11:46 [patch] md: memory leak on error path in dm_exception_store_create() Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox