public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] block: Fix memory leak in alloc_disk_node()
@ 2007-11-22 15:00 Jerome Marchand
  2007-11-23  8:17 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Jerome Marchand @ 2007-11-22 15:00 UTC (permalink / raw)
  To: linux-kernel; +Cc: axboe

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 <jmarchan@redhat.com>
---
 genhd.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/block/genhd.c b/block/genhd.c
index e609996..f2ac914 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;
 			}

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] block: Fix memory leak in alloc_disk_node()
  2007-11-22 15:00 [PATCH] block: Fix memory leak in alloc_disk_node() Jerome Marchand
@ 2007-11-23  8:17 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2007-11-23  8:17 UTC (permalink / raw)
  To: Jerome Marchand; +Cc: linux-kernel

On Thu, Nov 22 2007, Jerome Marchand wrote:
> Fix a memory leak in alloc_disk_node(). Don't forget to free 'dkstats'
> when the allocation of 'part' failed.

Thanks, applied.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-11-23  8:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-22 15:00 [PATCH] block: Fix memory leak in alloc_disk_node() Jerome Marchand
2007-11-23  8:17 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox