Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 38ae502b authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo
Browse files

perf probe: Handle strdup() failure



We could end up returning 0 (Ok) with a NULL raw_path. Fix it.

Acked-by: default avatarMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Naohiro Aota <naota@elisp.net>
Link: http://lkml.kernel.org/n/tip-l0kcbcg5f4nnzqt01cv42vec@git.kernel.org


Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent eb47cb2e
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -533,7 +533,7 @@ static int get_real_path(const char *raw_path, const char *comp_dir,
		else {
		else {
			if (access(raw_path, R_OK) == 0) {
			if (access(raw_path, R_OK) == 0) {
				*new_path = strdup(raw_path);
				*new_path = strdup(raw_path);
				return 0;
				return *new_path ? 0 : -ENOMEM;
			} else
			} else
				return -errno;
				return -errno;
		}
		}