Blob Blame History Raw
From 5147bbf46b81708a1ac544a4cfd204b50938c67c Mon Sep 17 00:00:00 2001
From: Hideo Yamauchi <renayama19661014@ybb.ne.jp>
Date: Tue, 6 Jan 2015 13:45:19 +0900
Subject: [PATCH] Fix: crmd: resolves memory leak in crmd.

---
 crmd/membership.c | 10 ++++++++--
 crmd/pengine.c    |  1 +
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/crmd/membership.c b/crmd/membership.c
index 9a58339..946cde0 100644
--- a/crmd/membership.c
+++ b/crmd/membership.c
@@ -215,9 +215,11 @@ search_conflicting_node_callback(xmlNode * msg, int call_id, int rc,
             crm_notice("Searching conflicting nodes for %s failed: %s (%d)",
                        new_node_uuid, pcmk_strerror(rc), rc);
         }
+        free(new_node_uuid);
         return;
 
     } else if (output == NULL) {
+        free(new_node_uuid);
         return;
     }
 
@@ -376,13 +378,17 @@ populate_cib_nodes(enum node_update_flags flags, const char *source)
 
         g_hash_table_iter_init(&iter, crm_peer_cache);
         while (g_hash_table_iter_next(&iter, NULL, (gpointer *) &node)) {
-            do_update_node_cib(node, flags, node_list, source);
+            xmlNode *update = NULL;
+            update = do_update_node_cib(node, flags, node_list, source);
+        	free_xml(update);
         }
 
         if (crm_remote_peer_cache) {
             g_hash_table_iter_init(&iter, crm_remote_peer_cache);
             while (g_hash_table_iter_next(&iter, NULL, (gpointer *) &node)) {
-                do_update_node_cib(node, flags, node_list, source);
+                xmlNode *update = NULL;
+                update = do_update_node_cib(node, flags, node_list, source);
+            	free_xml(update);
             }
         }
 
diff --git a/crmd/pengine.c b/crmd/pengine.c
index 2f7513f..35f35c6 100644
--- a/crmd/pengine.c
+++ b/crmd/pengine.c
@@ -277,6 +277,7 @@ force_local_option(xmlNode *xml, const char *attr_name, const char *attr_value)
 
         free(attr_id);
     }
+    freeXpathObject(xpathObj);
 }
 
 void
-- 
1.8.4.2