]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - managemon.c
Allow a metadata update to have a linked list of allocated spaces.
[thirdparty/mdadm.git] / managemon.c
index 5cc50d8d3d9473be7003045bb82708d03de91d50..860e5785aaf7f4abd9fa8e3418e740b6fbcf5cfa 100644 (file)
@@ -217,10 +217,16 @@ static void free_updates(struct metadata_update **update)
 {
        while (*update) {
                struct metadata_update *this = *update;
+               void **space_list = this->space_list;
 
                *update = this->next;
                free(this->buf);
                free(this->space);
+               while (space_list) {
+                       void *space = space_list;
+                       space_list = *space_list;
+                       free(space);
+               }
                free(this);
        }
 }
@@ -710,6 +716,7 @@ static void handle_message(struct supertype *container, struct metadata_update *
                mu->buf = msg->buf;
                msg->buf = NULL;
                mu->space = NULL;
+               mu->space_list = NULL;
                mu->next = NULL;
                if (container->ss->prepare_update)
                        container->ss->prepare_update(container, mu);