md: raid0: Fix a memory leak when stopping a raid0 array.

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Thursday, June 18, 2009 - 3:01 pm

Gitweb:     http://git.kernel.org/linus/fb5ab4b5d6e16fd5006c9f800d0116f3547cb760
Commit:     fb5ab4b5d6e16fd5006c9f800d0116f3547cb760
Parent:     ed7b00380d957ec770b5e90380d012c6062c13cc
Author:     Andre Noll <maan@systemlinux.org>
AuthorDate: Tue Jun 16 16:48:19 2009 +1000
Committer:  NeilBrown <neilb@suse.de>
CommitDate: Tue Jun 16 16:48:19 2009 +1000

    md: raid0: Fix a memory leak when stopping a raid0 array.
    
    raid0_stop() removes all references to the raid0 configuration but
    misses to free the ->devlist buffer.
    
    This patch closes this leak, removes a pointless initialization and
    fixes a coding style issue in raid0_stop().
    
    Signed-off-by: Andre Noll <maan@systemlinux.org>
    Signed-off-by: NeilBrown <neilb@suse.de>
---
 drivers/md/raid0.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c
index 99cee51..0d62ad6 100644
--- a/drivers/md/raid0.c
+++ b/drivers/md/raid0.c
@@ -298,16 +298,15 @@ static int raid0_run(mddev_t *mddev)
 	return 0;
 }
 
-static int raid0_stop (mddev_t *mddev)
+static int raid0_stop(mddev_t *mddev)
 {
 	raid0_conf_t *conf = mddev_to_conf(mddev);
 
 	blk_sync_queue(mddev->queue); /* the unplug fn references 'conf'*/
 	kfree(conf->strip_zone);
-	conf->strip_zone = NULL;
+	kfree(conf->devlist);
 	kfree(conf);
 	mddev->private = NULL;
-
 	return 0;
 }
 
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
md: raid0: Fix a memory leak when stopping a raid0 array., Linux Kernel Mailing ..., (Thu Jun 18, 3:01 pm)