]> git.proxmox.com Git - mirror_corosync.git/commitdiff
votequorum: free our data and lists on exit
authorFabio M. Di Nitto <fdinitto@redhat.com>
Fri, 2 Mar 2012 09:07:10 +0000 (10:07 +0100)
committerFabio M. Di Nitto <fdinitto@redhat.com>
Fri, 2 Mar 2012 13:36:48 +0000 (14:36 +0100)
this is mostly to avoid valgrind errors on exit and make the output
more readable.

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
exec/votequorum.c

index eda6daaf0e31161554d4cb413278af1e3f754e7c..9209bdd7bf24501487cf5eb22ad9aa863cf84e10 100644 (file)
@@ -1668,14 +1668,57 @@ static void message_handler_req_exec_votequorum_reconfigure (
 static int votequorum_exec_exit_fn (void)
 {
        int ret = 0;
+       struct cluster_node *node;
+       struct quorum_pd *qpd;
+       struct list_head *tmp;
 
        ENTER();
 
+       /*
+        * tell the other nodes we are leaving
+        */
+
        if (leave_remove) {
                us->flags |= NODE_FLAGS_LEAVING;
                ret = votequorum_exec_send_nodeinfo(us->node_id);
        }
 
+       /*
+        * clean up our internals
+        */
+
+       /*
+        * free the node list and qdevice
+        */
+
+       if (qdevice) {
+               free(qdevice);
+               qdevice = NULL;
+       }
+
+       list_iterate(tmp, &cluster_members_list) {
+               node = list_entry(tmp, struct cluster_node, list);
+               if (node) {
+                       list_del(tmp);
+                       free(node);
+                       node = NULL;
+               }
+       }
+
+       us = NULL;
+
+       /*
+        * clean the tracking list
+        * should we notify that service is going away?
+        */
+
+       list_iterate(tmp, &trackers_list) {
+               qpd = list_entry(tmp, struct quorum_pd, list);
+               if (qpd) {
+                       list_del(tmp);
+               }
+       }
+
        LEAVE();
        return ret;
 }