Avoid possible null dereference in Assemble.

If the first device we look at has no superblock,
there is no 'st' to free, so don't free it.
This commit is contained in:
Neil Brown 2008-05-15 15:50:42 +10:00
parent 6ac8aac226
commit ddd1a49251
1 changed files with 2 additions and 1 deletions

View File

@ -315,7 +315,8 @@ int Assemble(struct supertype *st, char *mddev, int mdfd,
if (!tst || !tst->sb) {
fprintf(stderr, Name ": %s has no superblock - assembly aborted\n",
devname);
st->ss->free_super(st);
if (st)
st->ss->free_super(st);
return 1;
}