Fix memory leak of 'st3' in array_try_spare()

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
Jes Sorensen 2011-11-01 14:51:30 +11:00 committed by NeilBrown
parent 5454b6f324
commit 1fdeb8a084
1 changed files with 3 additions and 1 deletions

View File

@ -878,8 +878,10 @@ static int array_try_spare(char *devname, int *dfdp, struct dev_policy *pol,
* to obtain minimum spare size */
struct supertype *st3 = dup_super(st2);
int mdfd = open_dev(mp->devnum);
if (!mdfd)
if (!mdfd) {
free(st3);
goto next;
}
if (st3->ss->load_container &&
!st3->ss->load_container(st3, mdfd, mp->path)) {
component_size = st3->ss->min_acceptable_spare_size(st3);