From: "Kunwu.Chan" <chentao@kylinos.cn>
To: peterz@infradead.org, mingo@redhat.com, acme@kernel.org,
mark.rutland@arm.com, alexander.shishkin@linux.intel.com,
jolsa@kernel.org, namhyung@kernel.org, irogers@google.com,
adrian.hunter@intel.com, kan.liang@linux.intel.com,
seanjc@google.com, kprateek.nayak@amd.com,
robert.richter@amd.com
Cc: linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
kunwu.chan@hotmail.com, "Kunwu.Chan" <chentao@kylinos.cn>
Subject: [PATCH] perf tools: Put the function return operation at the end of the function
Date: Thu, 12 Oct 2023 11:10:03 +0800 [thread overview]
Message-ID: <20231012031003.842368-1-chentao@kylinos.cn> (raw)
Function return operations should be performed after resource release.
Fixes: 4e1b9c679fcb ("perf tools: Refactor print_event_desc()")
Signed-off-by: Kunwu.Chan <chentao@kylinos.cn>
---
| 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
--git a/tools/perf/util/header.c b/tools/perf/util/header.c
index d812e1e371a7..5763f21844b1 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -1998,13 +1998,14 @@ static struct evsel *read_event_desc(struct feat_fd *ff)
id++;
}
}
-out:
- free(buf);
- return events;
+
error:
free_event_desc(events);
events = NULL;
- goto out;
+
+out:
+ free(buf);
+ return events;
}
static int __desc_attr__fprintf(FILE *fp, const char *name, const char *val,
--
2.25.1
next reply other threads:[~2023-10-12 3:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-12 3:10 Kunwu.Chan [this message]
2023-10-12 5:02 ` Adrian Hunter
2023-10-12 6:53 ` [PATCH v2] " Kunwu.Chan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231012031003.842368-1-chentao@kylinos.cn \
--to=chentao@kylinos.cn \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=kan.liang@linux.intel.com \
--cc=kprateek.nayak@amd.com \
--cc=kunwu.chan@hotmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=robert.richter@amd.com \
--cc=seanjc@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®