Fix possible NULL dereference in super_by_fd
[thirdparty/mdadm.git] / util.c
diff --git a/util.c b/util.c
index 108f3c1..1ad6fd0 100644 (file)
--- a/util.c
+++ b/util.c
@@ -757,7 +757,8 @@ struct supertype *super_by_fd(int fd)
 
        if (sra)
                sysfs_free(sra);
-       st->sb = NULL;
+       if (st)
+               st->sb = NULL;
        return st;
 }