]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Monitor(): free allocated memory on exit
authorJes Sorensen <Jes.Sorensen@redhat.com>
Tue, 1 Nov 2011 15:09:32 +0000 (16:09 +0100)
committerNeilBrown <neilb@suse.de>
Tue, 1 Nov 2011 23:48:53 +0000 (10:48 +1100)
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Monitor.c

index 101bca4cc8053198a0a09ec0f87be96e5a4687c3..fc0488bc64d250584f9a4505a2c60d8181656cd5 100644 (file)
--- a/Monitor.c
+++ b/Monitor.c
@@ -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;