diff options
author | Namhyung Kim <namhyung.kim@lge.com> | 2013-09-11 01:09:26 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-10-09 14:58:20 -0400 |
commit | 89da393c171926d3372f573d752be5ced98038eb (patch) | |
tree | 341ee9887bc5a739ca4ccf22c599dfd93c03c214 /tools/perf/util/annotate.c | |
parent | 963ba5fd5d04f36d6a5c9a94562484a4f270c1de (diff) |
perf annotate: Reuse path from the result of addr2line
In the symbol__get_source_line(), path and src_line->path will have same
value, but they were allocated separately, and leaks one. Just share
path to src_line->path.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Reviewed-by: Jiri Olsa <jolsa@redhat.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1378876173-13363-3-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/annotate.c')
-rw-r--r-- | tools/perf/util/annotate.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index 7eae5488ecea..c6fd1870f278 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c | |||
@@ -1143,11 +1143,7 @@ static int symbol__get_source_line(struct symbol *sym, struct map *map, | |||
1143 | if (getline(&path, &line_len, fp) < 0 || !line_len) | 1143 | if (getline(&path, &line_len, fp) < 0 || !line_len) |
1144 | goto next_close; | 1144 | goto next_close; |
1145 | 1145 | ||
1146 | src_line->path = malloc(sizeof(char) * line_len + 1); | 1146 | src_line->path = path; |
1147 | if (!src_line->path) | ||
1148 | goto next_close; | ||
1149 | |||
1150 | strcpy(src_line->path, path); | ||
1151 | insert_source_line(&tmp_root, src_line); | 1147 | insert_source_line(&tmp_root, src_line); |
1152 | 1148 | ||
1153 | next_close: | 1149 | next_close: |