diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/util/header.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index f6a929e74981..0866bcdb5e8e 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c | |||
@@ -270,11 +270,15 @@ int build_id_cache__add_s(const char *sbuild_id, const char *debugdir, | |||
270 | const char *name, bool is_kallsyms) | 270 | const char *name, bool is_kallsyms) |
271 | { | 271 | { |
272 | const size_t size = PATH_MAX; | 272 | const size_t size = PATH_MAX; |
273 | char *realname = realpath(name, NULL), | 273 | char *realname, *filename = malloc(size), |
274 | *filename = malloc(size), | ||
275 | *linkname = malloc(size), *targetname; | 274 | *linkname = malloc(size), *targetname; |
276 | int len, err = -1; | 275 | int len, err = -1; |
277 | 276 | ||
277 | if (is_kallsyms) | ||
278 | realname = (char *)name; | ||
279 | else | ||
280 | realname = realpath(name, NULL); | ||
281 | |||
278 | if (realname == NULL || filename == NULL || linkname == NULL) | 282 | if (realname == NULL || filename == NULL || linkname == NULL) |
279 | goto out_free; | 283 | goto out_free; |
280 | 284 | ||
@@ -306,7 +310,8 @@ int build_id_cache__add_s(const char *sbuild_id, const char *debugdir, | |||
306 | if (symlink(targetname, linkname) == 0) | 310 | if (symlink(targetname, linkname) == 0) |
307 | err = 0; | 311 | err = 0; |
308 | out_free: | 312 | out_free: |
309 | free(realname); | 313 | if (!is_kallsyms) |
314 | free(realname); | ||
310 | free(filename); | 315 | free(filename); |
311 | free(linkname); | 316 | free(linkname); |
312 | return err; | 317 | return err; |