public inbox for linux-raid@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: neilb@suse.de
Cc: linux-raid@vger.kernel.org
Subject: [patch] md: memory leak on error path in dm_exception_store_create()
Date: Sun, 19 Jul 2009 14:46:28 +0300 (EAT)	[thread overview]
Message-ID: <alpine.DEB.2.00.0907171414450.12306@bicker> (raw)

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;
 }

                 reply	other threads:[~2009-07-19 11:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.00.0907171414450.12306@bicker \
    --to=error27@gmail.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=neilb@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox