device-mapper-multipath/0085-multipath-tools-unit-tests-fix-memory-leaks-in-mpath.patch

51 lines
1.7 KiB
Diff
Raw Normal View History

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Fri, 18 Dec 2020 23:17:48 +0100
Subject: [PATCH] multipath-tools unit tests: fix memory leaks in mpathvalid
tests
They break "make valgrind-test".
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
tests/mpathvalid.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/tests/mpathvalid.c b/tests/mpathvalid.c
index 5ffabb9d..cfe4bae1 100644
--- a/tests/mpathvalid.c
+++ b/tests/mpathvalid.c
@@ -381,6 +381,7 @@ static void test_mpathvalid_is_path_good2(void **state)
assert_int_equal(mpathvalid_is_path(test_dev, MPATH_DEFAULT, &wwid,
wwids, 4), MPATH_IS_VALID);
assert_string_equal(wwid, TEST_WWID);
+ free(wwid);
}
static void test_mpathvalid_is_path_good3(void **state)
@@ -395,6 +396,7 @@ static void test_mpathvalid_is_path_good3(void **state)
assert_int_equal(mpathvalid_is_path(test_dev, MPATH_SMART, &wwid,
wwids, 4), MPATH_IS_VALID);
assert_string_equal(wwid, TEST_WWID);
+ free(wwid);
}
/* mabybe valid with no matching paths */
@@ -410,6 +412,7 @@ static void test_mpathvalid_is_path_good4(void **state)
assert_int_equal(mpathvalid_is_path(test_dev, MPATH_DEFAULT, &wwid,
wwids, 4), MPATH_IS_MAYBE_VALID);
assert_string_equal(wwid, TEST_WWID);
+ free(wwid);
}
/* maybe valid with matching paths */
@@ -425,6 +428,7 @@ static void test_mpathvalid_is_path_good5(void **state)
assert_int_equal(mpathvalid_is_path(test_dev, MPATH_DEFAULT, &wwid,
wwids, 4), MPATH_IS_VALID);
assert_string_equal(wwid, TEST_WWID);
+ free(wwid);
}
#define setup_test(name) \