projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
12ceade
)
perf annotate: Make a copy of filename for passing to basename
author
David Ahern
<
[email protected]
>
Sat, 8 Sep 2012 15:06:50 +0000
(09:06 -0600)
committer
Arnaldo Carvalho de Melo
<
[email protected]
>
Sat, 8 Sep 2012 20:14:43 +0000
(17:14 -0300)
The basename function may modify the string passed to it, so the string
should not be marked const.
Signed-off-by: David Ahern <
[email protected]
>
Acked-by: Pekka Enberg <
[email protected]
>
Cc: Irina Tirdea <
[email protected]
>
Cc: Pekka Enberg <
[email protected]
>
Link:
http://lkml.kernel.org/r/
[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <
[email protected]
>
tools/perf/util/annotate.c
patch
|
blob
|
history
diff --git
a/tools/perf/util/annotate.c
b/tools/perf/util/annotate.c
index 51ef69c9841dd076777326d9d01c5b5ae71f8335..04eafd3939df6b138cfade7c51435c60d94ff4f7 100644
(file)
--- a/
tools/perf/util/annotate.c
+++ b/
tools/perf/util/annotate.c
@@
-984,7
+984,8
@@
int symbol__annotate_printf(struct symbol *sym, struct map *map, int evidx,
int context)
{
struct dso *dso = map->dso;
- const char *filename = dso->long_name, *d_filename;
+ char *filename;
+ const char *d_filename;
struct annotation *notes = symbol__annotation(sym);
struct disasm_line *pos, *queue = NULL;
u64 start = map__rip_2objdump(map, sym->start);
@@
-992,6
+993,10
@@
int symbol__annotate_printf(struct symbol *sym, struct map *map, int evidx,
int more = 0;
u64 len;
+ filename = strdup(dso->long_name);
+ if (!filename)
+ return -ENOMEM;
+
if (full_paths)
d_filename = filename;
else
@@
-1042,6
+1047,8
@@
int symbol__annotate_printf(struct symbol *sym, struct map *map, int evidx,
}
}
+ free(filename);
+
return more;
}