linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jes.Sorensen@redhat.com
To: neilb@suse.de
Cc: linux-raid@vger.kernel.org, dledford@redhat.com
Subject: [PATCH 12/12] match_metadata_desc(): Fix memory leak
Date: Wed,  2 Nov 2011 15:42:17 +0100	[thread overview]
Message-ID: <1320244937-9739-13-git-send-email-Jes.Sorensen@redhat.com> (raw)
In-Reply-To: <1320244937-9739-1-git-send-email-Jes.Sorensen@redhat.com>

From: Jes Sorensen <Jes.Sorensen@redhat.com>

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
---
 super-mbr.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/super-mbr.c b/super-mbr.c
index 5eefdf6..6499963 100644
--- a/super-mbr.c
+++ b/super-mbr.c
@@ -169,13 +169,14 @@ static void getinfo_mbr(struct supertype *st, struct mdinfo *info, char *map)
 
 static struct supertype *match_metadata_desc(char *arg)
 {
-	struct supertype *st = malloc(sizeof(*st));
+	struct supertype *st;
 
-	if (!st)
-		return st;
 	if (strcmp(arg, "mbr") != 0)
 		return NULL;
 
+	st = malloc(sizeof(*st));
+	if (!st)
+		return st;
 	st->ss = &mbr;
 	st->info = NULL;
 	st->minor_version = 0;
-- 
1.7.6.4


  parent reply	other threads:[~2011-11-02 14:42 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-02 14:42 [PATCH 00/12] More leak and NULL pointer dereference fixes Jes.Sorensen
2011-11-02 14:42 ` [PATCH 01/12] mdadm: add missing break for UpdateSubarray Jes.Sorensen
2011-11-02 14:42 ` [PATCH 02/12] ping_monitor(): check file descriptor is valid before using and closing it Jes.Sorensen
2011-11-02 14:42 ` [PATCH 03/12] mdstat_read(): Check return value of dup() before using file descriptor Jes.Sorensen
2011-11-02 14:42 ` [PATCH 04/12] get_component_size(): Check read() return value for error before using it Jes.Sorensen
2011-11-02 14:42 ` [PATCH 05/12] array_try_spare(): open_dev() returns -1 on error, not zero Jes.Sorensen
2011-11-02 14:42 ` [PATCH 06/12] disk_init_and_add(): Fail if opening sysfs file descriptors fail Jes.Sorensen
2011-11-02 14:42 ` [PATCH 07/12] close_aa(): Verify file descriptors are valid before trying to close them Jes.Sorensen
2011-11-02 14:42 ` [PATCH 08/12] ahci_enumerate_ports(): Don't close fd that failed to open Jes.Sorensen
2011-11-02 14:42 ` [PATCH 09/12] unblock_monitor(): Check sra is valid before dereferencing Jes.Sorensen
2011-11-02 14:42 ` [PATCH 10/12] Manage_ro(): Check pointer rather than dereferencing it Jes.Sorensen
2011-11-02 14:42 ` [PATCH 11/12] fd2devname(): Don't dereference NULL pointer Jes.Sorensen
2011-11-02 14:42 ` Jes.Sorensen [this message]
2011-11-02 21:12 ` [PATCH 00/12] More leak and NULL pointer dereference fixes NeilBrown
2011-11-03 12:40   ` Jes Sorensen

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=1320244937-9739-13-git-send-email-Jes.Sorensen@redhat.com \
    --to=jes.sorensen@redhat.com \
    --cc=dledford@redhat.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;
as well as URLs for NNTP newsgroup(s).