All of lore.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Masami Hiramatsu <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, masami.hiramatsu.pt@hitachi.com,
	mingo@kernel.org, naota@elisp.net, tglx@linutronix.de,
	acme@redhat.com, peterz@infradead.org, hpa@zytor.com,
	namhyung@kernel.org
Subject: [tip:perf/core] perf probe: Fix get_real_path to free allocated memory in error path
Date: Sat, 28 Feb 2015 01:31:08 -0800	[thread overview]
Message-ID: <tip-eb47cb2eb22dfacac9689708f5bd3cb0e975e290@git.kernel.org> (raw)
In-Reply-To: <20150226082504.28125.74506.stgit@localhost.localdomain>

Commit-ID:  eb47cb2eb22dfacac9689708f5bd3cb0e975e290
Gitweb:     http://git.kernel.org/tip/eb47cb2eb22dfacac9689708f5bd3cb0e975e290
Author:     Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
AuthorDate: Thu, 26 Feb 2015 17:25:04 +0900
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 26 Feb 2015 11:59:05 -0300

perf probe: Fix get_real_path to free allocated memory in error path

Fix get_real_path to free allocated memory when comp_dir is used for
complementing path and getting an error.

Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Naohiro Aota <naota@elisp.net>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20150226082504.28125.74506.stgit@localhost.localdomain
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/probe-event.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 662d454..4a93bf4 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -549,9 +549,11 @@ static int get_real_path(const char *raw_path, const char *comp_dir,
 		if (access(*new_path, R_OK) == 0)
 			return 0;
 
-		if (!symbol_conf.source_prefix)
+		if (!symbol_conf.source_prefix) {
 			/* In case of searching comp_dir, don't retry */
+			zfree(new_path);
 			return -errno;
+		}
 
 		switch (errno) {
 		case ENAMETOOLONG:

  parent reply	other threads:[~2015-02-28  9:37 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
2015-02-27  0:58         ` Masami Hiramatsu
2015-02-28  9:31       ` tip-bot for Masami Hiramatsu [this message]
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=tip-eb47cb2eb22dfacac9689708f5bd3cb0e975e290@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=acme@redhat.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@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 \
    --cc=tglx@linutronix.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.