From 904c1ef77bcb3e3b151f544acf104cd36acdc5f6 Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Sat, 12 Jul 2008 20:27:33 +1000 Subject: [PATCH] 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. --- managemon.c | 4 +++- super-ddf.c | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) 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; -- 2.39.2