diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index 354e1e04a2662..81b7ec2ae8615 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c @@ -299,8 +299,11 @@ void perf_session__delete(struct perf_session *session) perf_session__release_decomp_events(session); perf_env__exit(&session->header.env); machines__exit(&session->machines); - if (session->data) + if (session->data) { + if (perf_data__is_read(session->data)) + evlist__delete(session->evlist); perf_data__close(session->data); + } free(session); }