Skip to contentSkip to conversation

block: Fix memory leak in alloc_disk_node()

PATCH Applied Jerome Marchand 2 participants 2 messages Nov 22, 2007 – Nov 23, 2007 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 genhd.c |    1 +
 1 file changed, 1 insertion(+)
block/genhd.c +1 -0
index e609996..f2ac914 100644
@@ -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;
 			}
Applied
#1 lore raw
Quoted 2 lines · Jerome Marchand

Fix a memory leak in alloc_disk_node(). Don't forget to free 'dkstats' when the allocation of 'part' failed.

Thanks, applied.

Signature · 1 line
Jens Axboe