Explorar o código

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 <jmarchan@redhat.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Jerome Marchand %!s(int64=17) %!d(string=hai) anos
pai
achega
c7674030e5
Modificáronse 1 ficheiros con 1 adicións e 0 borrados
  1. 1 0
      block/genhd.c

+ 1 - 0
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;
 			}