]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Fix freeing of updates that have been handled by monitor.
authorNeil Brown <neilb@suse.de>
Sat, 12 Jul 2008 10:27:33 +0000 (20:27 +1000)
committerNeil Brown <neilb@suse.de>
Sat, 12 Jul 2008 10:27:33 +0000 (20:27 +1000)
Yes, we do want to free the buf, and the space too if it is still
there.

managemon.c
super-ddf.c

index 9f3520e8ea8e475e7a535071550fd01943a69aca..4592a9914ff73fda42ea5a5b8b5c64265c3be2e2 100644 (file)
@@ -199,7 +199,9 @@ void check_update_queue(struct supertype *container)
        while (update_queue_handled) {
                struct metadata_update *this = update_queue_handled;
                update_queue_handled = this->next;
-//             free(this->buf);
+               free(this->buf);
+               if (this->space)
+                       free(this->space);
                free(this);
        }
        if (update_queue == NULL &&
index acfb491655ed7ab37b6fc12b162180fc3683f49b..339db9fab75914a92bbe08d80da6473256926994 100644 (file)
@@ -3045,8 +3045,8 @@ static struct mdinfo *ddf_activate_spare(struct active_array *a,
         * Create a metadata_update record to update the
         * phys_refnum and lba_offset values
         */
-       mu = malloc(sizeof(*mu) + ddf->conf_rec_len * 512);
-       mu->buf = (char*)(mu+1);
+       mu = malloc(sizeof(*mu));
+       mu->buf = malloc(ddf->conf_rec_len * 512);
        mu->space = malloc(sizeof(struct vcl));
        mu->len = ddf->conf_rec_len;
        mu->next = *updates;