perf symbols: Precisely specify if dso->{long,short}_name should be freed

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <new-submission>
Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
上级 39d17dac
...@@ -456,6 +456,7 @@ static int event__process_kernel_mmap(event_t *self, ...@@ -456,6 +456,7 @@ static int event__process_kernel_mmap(event_t *self,
goto out_problem; goto out_problem;
map->dso->short_name = name; map->dso->short_name = name;
map->dso->sname_alloc = 1;
map->end = map->start + self->mmap.len; map->end = map->start + self->mmap.len;
} else if (is_kernel_mmap) { } else if (is_kernel_mmap) {
const char *symbol_name = (self->mmap.filename + const char *symbol_name = (self->mmap.filename +
......
...@@ -224,7 +224,9 @@ void dso__delete(struct dso *self) ...@@ -224,7 +224,9 @@ void dso__delete(struct dso *self)
int i; int i;
for (i = 0; i < MAP__NR_TYPES; ++i) for (i = 0; i < MAP__NR_TYPES; ++i)
symbols__delete(&self->symbols[i]); symbols__delete(&self->symbols[i]);
if (self->long_name != self->name) if (self->sname_alloc)
free((char *)self->short_name);
if (self->lname_alloc)
free(self->long_name); free(self->long_name);
free(self); free(self);
} }
...@@ -1530,6 +1532,7 @@ static int map_groups__set_modules_path_dir(struct map_groups *self, ...@@ -1530,6 +1532,7 @@ static int map_groups__set_modules_path_dir(struct map_groups *self,
if (long_name == NULL) if (long_name == NULL)
goto failure; goto failure;
dso__set_long_name(map->dso, long_name); dso__set_long_name(map->dso, long_name);
map->dso->lname_alloc = 1;
dso__kernel_module_get_build_id(map->dso, ""); dso__kernel_module_get_build_id(map->dso, "");
} }
} }
......
...@@ -126,12 +126,14 @@ struct dso { ...@@ -126,12 +126,14 @@ struct dso {
struct list_head node; struct list_head node;
struct rb_root symbols[MAP__NR_TYPES]; struct rb_root symbols[MAP__NR_TYPES];
struct rb_root symbol_names[MAP__NR_TYPES]; struct rb_root symbol_names[MAP__NR_TYPES];
enum dso_kernel_type kernel;
u8 adjust_symbols:1; u8 adjust_symbols:1;
u8 slen_calculated:1; u8 slen_calculated:1;
u8 has_build_id:1; u8 has_build_id:1;
enum dso_kernel_type kernel;
u8 hit:1; u8 hit:1;
u8 annotate_warned:1; u8 annotate_warned:1;
u8 sname_alloc:1;
u8 lname_alloc:1;
unsigned char origin; unsigned char origin;
u8 sorted_by_name; u8 sorted_by_name;
u8 loaded; u8 loaded;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册