diff options
Diffstat (limited to 'tools/perf')
-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 5a72d421e211..e5230c0ef95b 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c | |||
@@ -189,11 +189,15 @@ int build_id_cache__add_s(const char *sbuild_id, const char *debugdir, | |||
189 | const char *name, bool is_kallsyms) | 189 | const char *name, bool is_kallsyms) |
190 | { | 190 | { |
191 | const size_t size = PATH_MAX; | 191 | const size_t size = PATH_MAX; |
192 | char *realname = realpath(name, NULL), | 192 | char *realname, *filename = malloc(size), |
193 | *filename = malloc(size), | ||
194 | *linkname = malloc(size), *targetname; | 193 | *linkname = malloc(size), *targetname; |
195 | int len, err = -1; | 194 | int len, err = -1; |
196 | 195 | ||
196 | if (is_kallsyms) | ||
197 | realname = (char *)name; | ||
198 | else | ||
199 | realname = realpath(name, NULL); | ||
200 | |||
197 | if (realname == NULL || filename == NULL || linkname == NULL) | 201 | if (realname == NULL || filename == NULL || linkname == NULL) |
198 | goto out_free; | 202 | goto out_free; |
199 | 203 | ||
@@ -225,7 +229,8 @@ int build_id_cache__add_s(const char *sbuild_id, const char *debugdir, | |||
225 | if (symlink(targetname, linkname) == 0) | 229 | if (symlink(targetname, linkname) == 0) |
226 | err = 0; | 230 | err = 0; |
227 | out_free: | 231 | out_free: |
228 | free(realname); | 232 | if (!is_kallsyms) |
233 | free(realname); | ||
229 | free(filename); | 234 | free(filename); |
230 | free(linkname); | 235 | free(linkname); |
231 | return err; | 236 | return err; |