]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
md: raid0: Fix a memory leak when stopping a raid0 array.
authorAndre Noll <maan@systemlinux.org>
Tue, 16 Jun 2009 06:48:19 +0000 (16:48 +1000)
committerNeilBrown <neilb@suse.de>
Tue, 16 Jun 2009 06:48:19 +0000 (16:48 +1000)
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

index 99cee51734e55d0dd5425db56b05dfa26d507297..0d62ad6df2129d3d95c782c2e40fb92562488b79 100644 (file)
@@ -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;
 }