File pacemaker-pengine-memory-leak-writing-graph-to-file.patch of Package pacemaker.14737

commit 997469bfbb954ad85f2d9b86f748dad323e7a8e6
Author: Ken Gaillot <kgaillot@redhat.com>
Date:   Thu Nov 2 15:17:45 2017 -0500

    Low: pengine: memory leak when writing graph to file
    
    also avoid glib command so we can use free()

diff --git a/pengine/pengine.c b/pengine/pengine.c
index a947ceb0e..b5242d25a 100644
--- a/pengine/pengine.c
+++ b/pengine/pengine.c
@@ -168,7 +168,8 @@ process_pe_message(xmlNode * msg, xmlNode * xml_data, crm_client_t * sender)
             char *graph_file = NULL;
             umask(S_IWGRP | S_IWOTH | S_IROTH);
 
-            graph_file = g_strdup_printf("%s/pengine.graph.XXXXXX", PE_STATE_DIR);
+            graph_file = crm_strdup_printf("%s/pengine.graph.XXXXXX",
+                                           PE_STATE_DIR);
             graph_file_fd = mkstemp(graph_file);
 
             crm_err("Couldn't send transition graph to peer, writing to %s instead",
@@ -177,6 +178,7 @@ process_pe_message(xmlNode * msg, xmlNode * xml_data, crm_client_t * sender)
             crm_xml_add(reply, F_CRM_TGRAPH, graph_file);
             write_xml_fd(data_set.graph, graph_file, graph_file_fd, FALSE);
 
+            free(graph_file);
             free_xml(first_named_child(reply, F_CRM_DATA));
             CRM_ASSERT(crm_ipcs_send(sender, 0, reply, crm_ipc_server_event));
         }
openSUSE Build Service is sponsored by