From: "Steven Rostedt (Google)" <rostedt@xxxxxxxxxxx> 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@xxxxxxxxxxx> --- utest/tracefs-utest.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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); -- 2.42.0