Monitor(): free allocated memory on exit

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 16:09:32 +01:00 committed by NeilBrown
parent bccd8153fa
commit b657208c50
1 changed files with 6 additions and 0 deletions

View File

@ -124,6 +124,7 @@ int Monitor(struct mddev_dev *devlist,
*/
struct state *statelist = NULL;
struct state *st2;
int finished = 0;
struct mdstat_ent *mdstat = NULL;
char *mailfrom = NULL;
@ -242,6 +243,11 @@ int Monitor(struct mddev_dev *devlist,
}
test = 0;
}
for (st2 = statelist; st2; st2 = statelist) {
statelist = st2->next;
free(st2);
}
if (pidfile)
unlink(pidfile);
return 0;