diff mbox series

[06/23] libtracefs: Free dynamic event list in utest

Message ID 20231228203714.53294-7-rostedt@goodmis.org (mailing list archive)
State Superseded
Headers show
Series libtracefs: Several updates | expand

Commit Message

Steven Rostedt Dec. 28, 2023, 8:35 p.m. UTC
From: "Steven Rostedt (Google)" <rostedt@goodmis.org>

When adding the tests for the tracefs_kprobe_destroy() API, the call to
get_dynevents_check() did not save the results and free it. This check can
only be ignored if the expected result is zero (passed in as the second
parameter), as in that case, the return would be NULL.

Fixes: 18ede68f ("libtracefs: Add tracefs_kprobe_destory() API")
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 utest/tracefs-utest.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/utest/tracefs-utest.c b/utest/tracefs-utest.c
index 5ce4bafbfda5..28960c191581 100644
--- a/utest/tracefs-utest.c
+++ b/utest/tracefs-utest.c
@@ -1364,7 +1364,9 @@  static void test_kprobes_instance(struct tracefs_instance *instance)
 		ret = tracefs_kprobe_destroy(ktests[i].system, ktests[i].event,
 					     ktests[i].address, ktests[i].format, true);
 		CU_TEST(ret == 0);
-		get_dynevents_check(TRACEFS_DYNEVENT_KPROBE, kprobe_count - (i + 1));
+		devents = get_dynevents_check(TRACEFS_DYNEVENT_KPROBE,
+					      kprobe_count - (i + 1));
+		tracefs_dynevent_list_free(devents);
 	}
 	get_dynevents_check(TRACEFS_DYNEVENT_KPROBE, 0);
 
@@ -1372,7 +1374,9 @@  static void test_kprobes_instance(struct tracefs_instance *instance)
 		ret = tracefs_kprobe_destroy(kretests[i].system, kretests[i].event,
 					     kretests[i].address, kretests[i].format, true);
 		CU_TEST(ret == 0);
-		get_dynevents_check(TRACEFS_DYNEVENT_KRETPROBE, kretprobe_count - (i + 1));
+		devents = get_dynevents_check(TRACEFS_DYNEVENT_KRETPROBE,
+					      kretprobe_count - (i + 1));
+		tracefs_dynevent_list_free(devents);
 	}
 	get_dynevents_check(TRACEFS_DYNEVENT_KRETPROBE, 0);