summary refs log tree commit diff
path: root/tools/perf/tests/attr.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2021-03-18 15:27:03 +0100
committerIngo Molnar <mingo@kernel.org>2021-03-18 15:27:03 +0100
commit14ff3ed86e2c1700345f411b90a78f62867f217e (patch)
tree0eec583be82296fa6359edb59f2921095eef0dc2 /tools/perf/tests/attr.c
parent81519f778830d1ab02274eeaaeab6797fdc4ec52 (diff)
parent1e28eed17697bcf343c6743f0028cc3b5dd88bf0 (diff)
downloadlinux-14ff3ed86e2c1700345f411b90a78f62867f217e.tar.gz
Merge tag 'v5.12-rc3' into x86/cleanups, to refresh the tree
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools/perf/tests/attr.c')
-rw-r--r--tools/perf/tests/attr.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/tools/perf/tests/attr.c b/tools/perf/tests/attr.c
index ec972e0892ab..dd39ce9b0277 100644
--- a/tools/perf/tests/attr.c
+++ b/tools/perf/tests/attr.c
@@ -182,14 +182,20 @@ int test__attr(struct test *test __maybe_unused, int subtest __maybe_unused)
 	struct stat st;
 	char path_perf[PATH_MAX];
 	char path_dir[PATH_MAX];
+	char *exec_path;
 
 	/* First try development tree tests. */
 	if (!lstat("./tests", &st))
 		return run_dir("./tests", "./perf");
 
+	exec_path = get_argv_exec_path();
+	if (exec_path == NULL)
+		return -1;
+
 	/* Then installed path. */
-	snprintf(path_dir,  PATH_MAX, "%s/tests", get_argv_exec_path());
+	snprintf(path_dir,  PATH_MAX, "%s/tests", exec_path);
 	snprintf(path_perf, PATH_MAX, "%s/perf", BINDIR);
+	free(exec_path);
 
 	if (!lstat(path_dir, &st) &&
 	    !lstat(path_perf, &st))