[PATCH 2/4] perf tools: Move zstd_fini() to session deletion
From: Tommi Rantala
Date: Fri Apr 17 2020 - 09:24:00 EST
Move zstd_fini() call to perf_session__delete(), so that we always
cleanup the zstd state when deleting the session.
Signed-off-by: Tommi Rantala <tommi.t.rantala@xxxxxxxxx>
---
tools/perf/builtin-inject.c | 1 -
tools/perf/builtin-record.c | 1 -
tools/perf/builtin-report.c | 1 -
tools/perf/util/session.c | 1 +
4 files changed, 1 insertion(+), 3 deletions(-)
diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c
index 7e124a7b8bfd..1ffb8393357a 100644
--- a/tools/perf/builtin-inject.c
+++ b/tools/perf/builtin-inject.c
@@ -836,7 +836,6 @@ int cmd_inject(int argc, const char **argv)
ret = __cmd_inject(&inject);
out_delete:
- zstd_fini(&(inject.session->zstd_data));
perf_session__delete(inject.session);
return ret;
}
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 1ab349abe904..8ed00de1ca29 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -1827,7 +1827,6 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
}
out_delete_session:
- zstd_fini(&session->zstd_data);
perf_session__delete(session);
if (!opts->no_bpf_event)
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 26d8fc27e427..e06e14980264 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -1579,7 +1579,6 @@ int cmd_report(int argc, const char **argv)
report.block_reports = NULL;
}
- zstd_fini(&(session->zstd_data));
perf_session__delete(session);
return ret;
}
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 0b0bfe5bef17..64e8b794b0bc 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -302,6 +302,7 @@ void perf_session__delete(struct perf_session *session)
machines__exit(&session->machines);
if (session->data)
perf_data__close(session->data);
+ zstd_fini(&session->zstd_data);
free(session);
}
--
2.25.2