match_metadata_desc(): Fix memory leak

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
Jes Sorensen 2011-11-03 08:10:08 +11:00 committed by NeilBrown
parent 7897de29b5
commit 62f5838f5b
1 changed files with 4 additions and 3 deletions

View File

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