summaryrefslogtreecommitdiff
path: root/tools/perf/util/sample.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/sample.c')
-rw-r--r--tools/perf/util/sample.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/tools/perf/util/sample.c b/tools/perf/util/sample.c
index cf73329326d7..bccc19e2aaf2 100644
--- a/tools/perf/util/sample.c
+++ b/tools/perf/util/sample.c
@@ -1,18 +1,23 @@
/* SPDX-License-Identifier: GPL-2.0 */
#include "sample.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+#include <elf.h>
+#include <linux/zalloc.h>
+
+#include "../../arch/x86/include/asm/insn.h"
#include "debug.h"
+#include "evsel.h"
#include "thread.h"
-#include <elf.h>
+
#ifndef EM_CSKY
#define EM_CSKY 252
#endif
#ifndef EM_LOONGARCH
#define EM_LOONGARCH 258
#endif
-#include <linux/zalloc.h>
-#include <stdlib.h>
-#include <string.h>
-#include "../../arch/x86/include/asm/insn.h"
void perf_sample__init(struct perf_sample *sample, bool all)
{
@@ -29,6 +34,8 @@ void perf_sample__init(struct perf_sample *sample, bool all)
void perf_sample__exit(struct perf_sample *sample)
{
+ evsel__put(sample->evsel);
+ sample->evsel = NULL;
zfree(&sample->user_regs);
zfree(&sample->intr_regs);
if (sample->merged_callchain) {