[PATCH 03/20] perf test: session_topology: delete session->evlist

From: Riccardo Mancini
Date: Thu Jul 15 2021 - 12:07:38 EST


ASan reports a memory leak related to session->evlist while running
the perf test "41: Session topology".

When perf_data is in write mode, session->evlist is owned by the
caller, which should also take care of deleting it.

This patch adds the missing evlist__delete.

Signed-off-by: Riccardo Mancini <rickyman7@xxxxxxxxx>
---
tools/perf/tests/topology.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/tools/perf/tests/topology.c b/tools/perf/tests/topology.c
index ec4e3b21b8311f57..b5efe675b321746e 100644
--- a/tools/perf/tests/topology.c
+++ b/tools/perf/tests/topology.c
@@ -61,6 +61,7 @@ static int session_write_header(char *path)
TEST_ASSERT_VAL("failed to write header",
!perf_session__write_header(session, session->evlist, data.file.fd, true));

+ evlist__delete(session->evlist);
perf_session__delete(session);

return 0;
--
2.31.1