Skip to content

Commit

Permalink
block: Fix memory leak in alloc_disk_node()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jerome Marchand authored and Jens Axboe committed Nov 27, 2007
1 parent 8c8d721 commit c767403
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions block/genhd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit c767403

Please sign in to comment.