提交 c7674030 编写于 作者: J Jerome Marchand 提交者: Jens Axboe

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: NJerome Marchand <jmarchan@redhat.com>
Signed-off-by: NJens Axboe <jens.axboe@oracle.com>
上级 8c8d7214
...@@ -715,6 +715,7 @@ struct gendisk *alloc_disk_node(int minors, int node_id) ...@@ -715,6 +715,7 @@ struct gendisk *alloc_disk_node(int minors, int node_id)
disk->part = kmalloc_node(size, disk->part = kmalloc_node(size,
GFP_KERNEL | __GFP_ZERO, node_id); GFP_KERNEL | __GFP_ZERO, node_id);
if (!disk->part) { if (!disk->part) {
free_disk_stats(disk);
kfree(disk); kfree(disk);
return NULL; return NULL;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册