From: Neil Brown Date: Sat, 12 Jul 2008 10:27:33 +0000 (+1000) Subject: Fix freeing of updates that have been handled by monitor. X-Git-Tag: mdadm-3.0-devel1~156 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=904c1ef77bcb3e3b151f544acf104cd36acdc5f6;p=thirdparty%2Fmdadm.git Fix freeing of updates that have been handled by monitor. Yes, we do want to free the buf, and the space too if it is still there. --- diff --git a/managemon.c b/managemon.c index 9f3520e8..4592a991 100644 --- a/managemon.c +++ b/managemon.c @@ -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 && diff --git a/super-ddf.c b/super-ddf.c index acfb4916..339db9fa 100644 --- a/super-ddf.c +++ b/super-ddf.c @@ -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;