From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
namhyung@kernel.org, Naohiro Aota <naota@elisp.net>,
Ingo Molnar <mingo@kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH perf/core ] [BUGFIX] perf-probe: Fix get_real_path to free allocated memory in error path
Date: Thu, 26 Feb 2015 11:46:33 -0300 [thread overview]
Message-ID: <20150226144633.GD1079@kernel.org> (raw)
In-Reply-To: <20150226082504.28125.74506.stgit@localhost.localdomain>
Em Thu, Feb 26, 2015 at 05:25:04PM +0900, Masami Hiramatsu escreveu:
> Fix get_real_path to free allocated memory when comp_dir
> is used for complementing path and getting an error.
While reviewing this patch I noticed this is needed, ack?
- Arnaldo
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 4a93bf433344..9526cf37682e 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -533,7 +533,7 @@ static int get_real_path(const char *raw_path, const char *comp_dir,
else {
if (access(raw_path, R_OK) == 0) {
*new_path = strdup(raw_path);
- return 0;
+ return *new_path ? 0 : -ENOMEM;
} else
return -errno;
}
next prev parent reply other threads:[~2015-02-26 14:46 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-26 7:12 [PATCH 1/2] perf probe: export get_real_path Naohiro Aota
2015-02-26 7:12 ` [PATCH 2/2] perf probe: Find compilation directory path for lazy matching Naohiro Aota
2015-02-26 8:08 ` Masami Hiramatsu
2015-02-26 8:25 ` [PATCH perf/core ] [BUGFIX] perf-probe: Fix get_real_path to free allocated memory in error path Masami Hiramatsu
2015-02-26 14:46 ` Arnaldo Carvalho de Melo [this message]
2015-02-27 0:58 ` Masami Hiramatsu
2015-02-28 9:31 ` [tip:perf/core] perf probe: " tip-bot for Masami Hiramatsu
2015-02-26 7:50 ` [PATCH 1/2] perf probe: export get_real_path Masami Hiramatsu
2015-03-04 7:52 ` [PATCH v2] perf probe: Find compilation directory path for lazy matching Naohiro Aota
2015-03-04 12:34 ` Masami Hiramatsu
2015-03-11 13:30 ` Arnaldo Carvalho de Melo
2015-03-12 1:42 ` Masami Hiramatsu
2015-03-13 5:13 ` Naohiro Aota
2015-03-13 5:18 ` [PATCH v3] " Naohiro Aota
2015-03-13 12:21 ` Masami Hiramatsu
2015-04-13 23:10 ` Arnaldo Carvalho de Melo
2015-04-14 6:35 ` Masami Hiramatsu
2015-04-14 12:17 ` [tip:perf/urgent] " tip-bot for Naohiro Aota
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=20150226144633.GD1079@kernel.org \
--to=acme@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=masami.hiramatsu.pt@hitachi.com \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=naota@elisp.net \
--cc=peterz@infradead.org \
/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;
as well as URLs for NNTP newsgroup(s).