]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - mapfile.c
Free map to avoid resource leak issues
[thirdparty/mdadm.git] / mapfile.c
index 243ded18d9fb628b1198555f532ed53c9b2a3b1b..a50255632d285ccae210d91dfabbc4da2e3501fb 100644 (file)
--- a/mapfile.c
+++ b/mapfile.c
@@ -143,6 +143,8 @@ void map_unlock(struct map_ent **melp)
                unlink(mapname[2]);
                fclose(lf);
        }
+       if (*melp)
+               map_free(*melp);
        lf = NULL;
 }
 
@@ -374,7 +376,7 @@ void RebuildMap(void)
                        char dn[30];
                        int dfd;
                        int ok;
-                       int devid;
+                       dev_t devid;
                        struct supertype *st;
                        char *subarray = NULL;
                        char *path;
@@ -439,8 +441,8 @@ void RebuildMap(void)
                                        if ((homehost == NULL ||
                                             st->ss->match_home(st, homehost) != 1) &&
                                            st->ss->match_home(st, "any") != 1 &&
-                                           (require_homehost
-                                            || ! conf_name_is_free(info->name)))
+                                           (require_homehost ||
+                                            !conf_name_is_free(info->name)))
                                                /* require a numeric suffix */
                                                unum = 0;
                                        else