]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Avoid possible null dereference in Assemble.
authorNeil Brown <neilb@suse.de>
Thu, 15 May 2008 05:50:42 +0000 (15:50 +1000)
committerNeil Brown <neilb@suse.de>
Thu, 15 May 2008 05:50:42 +0000 (15:50 +1000)
If the first device we look at has no superblock,
there is no 'st' to free, so don't free it.

Assemble.c

index c7cc385da98d6b1e9a26d8531e08a4cd573eb8c7..862120326d62a352fd75d7cc78be83872dfc775f 100644 (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;
                }