Blob Blame History Raw
From: Ken Gaillot <kgaillot@redhat.com>
Date: Mon, 14 Sep 2015 15:00:13 -0500
Subject: [PATCH] Fix: pacemaker_remote: memory leak in ipc_proxy_dispatch()

Detected via routine valgrind testing

(cherry picked from commit 3bb439d1554cb5567b886c52107bd3bb6f27b696)
---
 lrmd/ipc_proxy.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lrmd/ipc_proxy.c b/lrmd/ipc_proxy.c
index 9427393..2a5ad78 100644
--- a/lrmd/ipc_proxy.c
+++ b/lrmd/ipc_proxy.c
@@ -223,9 +223,9 @@ ipc_proxy_dispatch(qb_ipcs_connection_t * c, void *data, size_t size)
     }
 
     CRM_CHECK(client != NULL, crm_err("Invalid client");
-              return FALSE);
+              free_xml(request); return FALSE);
     CRM_CHECK(client->id != NULL, crm_err("Invalid client: %p", client);
-              return FALSE);
+              free_xml(request); return FALSE);
 
     /* this ensures that synced request/responses happen over the event channel
      * in the crmd, allowing the crmd to process the messages async */
@@ -241,6 +241,7 @@ ipc_proxy_dispatch(qb_ipcs_connection_t * c, void *data, size_t size)
     crm_xml_add_int(msg, F_LRMD_IPC_MSG_FLAGS, flags);
     add_message_xml(msg, F_LRMD_IPC_MSG, request);
     lrmd_server_send_notify(ipc_proxy, msg);
+    free_xml(request);
     free_xml(msg);
 
     return 0;