aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <[email protected]>2015-02-26 11:47:18 -0300
committerArnaldo Carvalho de Melo <[email protected]>2015-02-27 10:08:29 -0300
commit38ae502b1df196f712f6f5d3609afc36337b330b (patch)
tree0e2bccc1b23206d234055a9662cd3edfdc33c6ea
parenteb47cb2eb22dfacac9689708f5bd3cb0e975e290 (diff)
perf probe: Handle strdup() failure
We could end up returning 0 (Ok) with a NULL raw_path. Fix it. Acked-by: Masami Hiramatsu <[email protected]> Cc: David Ahern <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Naohiro Aota <[email protected]> Link: http://lkml.kernel.org/n/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
-rw-r--r--tools/perf/util/probe-event.c2
1 files changed, 1 insertions, 1 deletions
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;
}