diff options
author | Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> | 2015-02-26 03:25:04 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2015-02-26 09:59:05 -0500 |
commit | eb47cb2eb22dfacac9689708f5bd3cb0e975e290 (patch) | |
tree | c44d9dfc967fb2eef639a529ce74dffb1f3da27f /tools | |
parent | 9aaf5a5f479bd68699f2e6f6e5e5f1253377b6da (diff) |
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>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/util/probe-event.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index 662d454cb667..4a93bf433344 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, | |||
549 | if (access(*new_path, R_OK) == 0) | 549 | if (access(*new_path, R_OK) == 0) |
550 | return 0; | 550 | return 0; |
551 | 551 | ||
552 | if (!symbol_conf.source_prefix) | 552 | if (!symbol_conf.source_prefix) { |
553 | /* In case of searching comp_dir, don't retry */ | 553 | /* In case of searching comp_dir, don't retry */ |
554 | zfree(new_path); | ||
554 | return -errno; | 555 | return -errno; |
556 | } | ||
555 | 557 | ||
556 | switch (errno) { | 558 | switch (errno) { |
557 | case ENAMETOOLONG: | 559 | case ENAMETOOLONG: |