block: fix add_partition() error path

Partition stats structure was not freed on devt allocation failure
path. Fix it.

Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>

authored by Tejun Heo and committed by Jens Axboe eb60fa10 4e14e833

+3 -1
+3 -1
fs/partitions/check.c
··· 395 395 396 396 err = blk_alloc_devt(p, &devt); 397 397 if (err) 398 - goto out_free; 398 + goto out_free_stats; 399 399 pdev->devt = devt; 400 400 401 401 /* delay uevent until 'holders' subdir is created */ ··· 426 426 427 427 return 0; 428 428 429 + out_free_stats: 430 + free_part_stats(p); 429 431 out_free: 430 432 kfree(p); 431 433 return err;