Blame SOURCES/007-memory-leak.patch

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