From 1fdeb8a08457c80cec0d067d0916e2b9159a55ce Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Tue, 1 Nov 2011 14:51:30 +1100 Subject: Fix memory leak of 'st3' in array_try_spare() Signed-off-by: Jes Sorensen Signed-off-by: NeilBrown --- Incremental.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Incremental.c') diff --git a/Incremental.c b/Incremental.c index b5d3e025..cedb7928 100644 --- a/Incremental.c +++ b/Incremental.c @@ -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); -- cgit v1.2.3