Blame SOURCES/007-memory-leak.patch

533c21
From f491d9d5a7ed554fed985de356bb085fdec3421c Mon Sep 17 00:00:00 2001
533c21
From: Ken Gaillot <kgaillot@redhat.com>
533c21
Date: Tue, 7 Dec 2021 09:01:00 -0600
533c21
Subject: [PATCH] Fix: fencer: avoid memory leak when broadcasting history
533c21
 differences
533c21
533c21
Regression introduced in 2.1.0 by dbc27b2
533c21
---
533c21
 daemons/fenced/fenced_history.c | 7 +++++--
533c21
 1 file changed, 5 insertions(+), 2 deletions(-)
533c21
533c21
diff --git a/daemons/fenced/fenced_history.c b/daemons/fenced/fenced_history.c
533c21
index bc159383c..a9c57dc86 100644
533c21
--- a/daemons/fenced/fenced_history.c
533c21
+++ b/daemons/fenced/fenced_history.c
533c21
@@ -484,8 +484,6 @@ stonith_fence_history(xmlNode *msg, xmlNode **output,
533c21
                    !pcmk__str_eq(remote_peer, stonith_our_uname, pcmk__str_casei)) {
533c21
             xmlNode *history = get_xpath_object("//" F_STONITH_HISTORY_LIST,
533c21
                                                 msg, LOG_NEVER);
533c21
-            GHashTable *received_history =
533c21
-                history?stonith_xml_history_to_list(history):NULL;
533c21
 
533c21
             /* either a broadcast created directly upon stonith-API request
533c21
             * or a diff as response to such a thing
533c21
@@ -497,6 +495,11 @@ stonith_fence_history(xmlNode *msg, xmlNode **output,
533c21
             if (!history ||
533c21
                 !crm_is_true(crm_element_value(history,
533c21
                                                F_STONITH_DIFFERENTIAL))) {
533c21
+                GHashTable *received_history = NULL;
533c21
+
533c21
+                if (history != NULL) {
533c21
+                    received_history = stonith_xml_history_to_list(history);
533c21
+                }
533c21
                 out_history =
533c21
                     stonith_local_history_diff_and_merge(received_history, TRUE, NULL);
533c21
                 if (out_history) {
533c21
-- 
533c21
2.27.0
533c21