From: Jerome Marchand Date: Fri, 23 Nov 2007 08:17:53 +0000 (+0100) Subject: block: Fix memory leak in alloc_disk_node() X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=c7674030e5eb83d9ba29318fb9b3ccedf84d583e;p=openwrt%2Fstaging%2Fblogic.git block: Fix memory leak in alloc_disk_node() Fix a memory leak in alloc_disk_node(). Don't forget to free 'dkstats' when the allocation of 'part' failed. Signed-off-by: Jerome Marchand Signed-off-by: Jens Axboe --- diff --git a/block/genhd.c b/block/genhd.c index e609996f2e76..f2ac914160d1 100644 --- a/block/genhd.c +++ b/block/genhd.c @@ -715,6 +715,7 @@ struct gendisk *alloc_disk_node(int minors, int node_id) disk->part = kmalloc_node(size, GFP_KERNEL | __GFP_ZERO, node_id); if (!disk->part) { + free_disk_stats(disk); kfree(disk); return NULL; }