File bsc#1211678-0002-Fix-libcrmcommon-Free-the-results-in-various-test-ca.patch of Package pacemaker.38495
From e7058c15de5aa4e3505929d4578512ffceee9a79 Mon Sep 17 00:00:00 2001
From: Chris Lumens <clumens@redhat.com>
Date: Mon, 25 Jan 2021 11:06:30 -0500
Subject: [PATCH 2/6] Fix: libcrmcommon: Free the results in various test
cases.
---
lib/common/tests/strings/pcmk__add_word_test.c | 8 +++++++-
lib/common/tests/xpath/pcmk__xpath_node_id_test.c | 11 +++++++++--
2 files changed, 16 insertions(+), 3 deletions(-)
Index: pacemaker-2.0.5+20201202.ba59be712/lib/common/tests/strings/pcmk__add_word_test.c
===================================================================
--- pacemaker-2.0.5+20201202.ba59be712.orig/lib/common/tests/strings/pcmk__add_word_test.c
+++ pacemaker-2.0.5+20201202.ba59be712/lib/common/tests/strings/pcmk__add_word_test.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2020 the Pacemaker project contributors
+ * Copyright 2020-2021 the Pacemaker project contributors
*
* The version control history for this file may have further details.
*
@@ -21,6 +21,7 @@ add_words(void)
pcmk__add_word(&list, &list_len, "hello");
pcmk__add_word(&list, &list_len, "world");
g_assert_cmpint(strcmp(list, "hello world"), ==, 0);
+ free(list);
}
static void
@@ -31,6 +32,7 @@ add_with_no_len(void)
pcmk__add_word(&list, NULL, "hello");
pcmk__add_word(&list, NULL, "world");
g_assert_cmpint(strcmp(list, "hello world"), ==, 0);
+ free(list);
}
static void
@@ -42,6 +44,7 @@ add_nothing(void)
pcmk__add_word(&list, NULL, NULL);
pcmk__add_word(&list, NULL, "");
g_assert_cmpint(strcmp(list, "hello"), ==, 0);
+ free(list);
}
static void
@@ -54,6 +57,7 @@ add_with_null(void)
pcmk__add_separated_word(&list, &list_len, "world", NULL);
pcmk__add_separated_word(&list, &list_len, "I am a unit test", NULL);
g_assert_cmpint(strcmp(list, "hello world I am a unit test"), ==, 0);
+ free(list);
}
static void
@@ -66,6 +70,7 @@ add_with_comma(void)
pcmk__add_separated_word(&list, &list_len, "world", ",");
pcmk__add_separated_word(&list, &list_len, "I am a unit test", ",");
g_assert_cmpint(strcmp(list, "hello,world,I am a unit test"), ==, 0);
+ free(list);
}
static void
@@ -78,6 +83,7 @@ add_with_comma_and_space(void)
pcmk__add_separated_word(&list, &list_len, "world", ", ");
pcmk__add_separated_word(&list, &list_len, "I am a unit test", ", ");
g_assert_cmpint(strcmp(list, "hello, world, I am a unit test"), ==, 0);
+ free(list);
}
int