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 396 err = blk_alloc_devt(p, &devt); 397 if (err) 398 - goto out_free; 399 pdev->devt = devt; 400 401 /* delay uevent until 'holders' subdir is created */ ··· 426 427 return 0; 428 429 out_free: 430 kfree(p); 431 return err;
··· 395 396 err = blk_alloc_devt(p, &devt); 397 if (err) 398 + goto out_free_stats; 399 pdev->devt = devt; 400 401 /* delay uevent until 'holders' subdir is created */ ··· 426 427 return 0; 428 429 + out_free_stats: 430 + free_part_stats(p); 431 out_free: 432 kfree(p); 433 return err;