Commit bfd14b9a authored by David Ahern's avatar David Ahern Committed by Arnaldo Carvalho de Melo

perf annotate: Make a copy of filename for passing to basename

The basename function may modify the string passed to it, so the string
should not be marked const.
Signed-off-by: default avatarDavid Ahern <dsahern@gmail.com>
Acked-by: default avatarPekka Enberg <penberg@kernel.org>
Cc: Irina Tirdea <irina.tirdea@gmail.com>
Cc: Pekka Enberg <penberg@kernel.org>
Link: http://lkml.kernel.org/r/1347116812-93646-2-git-send-email-dsahern@gmail.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 12ceaded
...@@ -984,7 +984,8 @@ int symbol__annotate_printf(struct symbol *sym, struct map *map, int evidx, ...@@ -984,7 +984,8 @@ int symbol__annotate_printf(struct symbol *sym, struct map *map, int evidx,
int context) int context)
{ {
struct dso *dso = map->dso; 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 annotation *notes = symbol__annotation(sym);
struct disasm_line *pos, *queue = NULL; struct disasm_line *pos, *queue = NULL;
u64 start = map__rip_2objdump(map, sym->start); u64 start = map__rip_2objdump(map, sym->start);
...@@ -992,6 +993,10 @@ int symbol__annotate_printf(struct symbol *sym, struct map *map, int evidx, ...@@ -992,6 +993,10 @@ int symbol__annotate_printf(struct symbol *sym, struct map *map, int evidx,
int more = 0; int more = 0;
u64 len; u64 len;
filename = strdup(dso->long_name);
if (!filename)
return -ENOMEM;
if (full_paths) if (full_paths)
d_filename = filename; d_filename = filename;
else else
...@@ -1042,6 +1047,8 @@ int symbol__annotate_printf(struct symbol *sym, struct map *map, int evidx, ...@@ -1042,6 +1047,8 @@ int symbol__annotate_printf(struct symbol *sym, struct map *map, int evidx,
} }
} }
free(filename);
return more; return more;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment