diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2010-07-29 14:11:30 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2010-07-29 14:11:30 -0400 |
commit | 6e406257b3794009e3b7a6d48b54beb547719565 (patch) | |
tree | b2c79008271fd1741ac2b576379a3c29f4bc89e0 /tools/perf/util | |
parent | 39d17dacb3c25df878b56aa80a170d6088e041f9 (diff) |
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: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util')
-rw-r--r-- | tools/perf/util/event.c | 1 | ||||
-rw-r--r-- | tools/perf/util/symbol.c | 5 | ||||
-rw-r--r-- | tools/perf/util/symbol.h | 4 |
3 files changed, 8 insertions, 2 deletions
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c index 5b81bb29a07a..8151d23664c7 100644 --- a/tools/perf/util/event.c +++ b/tools/perf/util/event.c | |||
@@ -456,6 +456,7 @@ static int event__process_kernel_mmap(event_t *self, | |||
456 | goto out_problem; | 456 | goto out_problem; |
457 | 457 | ||
458 | map->dso->short_name = name; | 458 | map->dso->short_name = name; |
459 | map->dso->sname_alloc = 1; | ||
459 | map->end = map->start + self->mmap.len; | 460 | map->end = map->start + self->mmap.len; |
460 | } else if (is_kernel_mmap) { | 461 | } else if (is_kernel_mmap) { |
461 | const char *symbol_name = (self->mmap.filename + | 462 | const char *symbol_name = (self->mmap.filename + |
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index bc6e7e8c480d..242d2b216f46 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c | |||
@@ -224,7 +224,9 @@ void dso__delete(struct dso *self) | |||
224 | int i; | 224 | int i; |
225 | for (i = 0; i < MAP__NR_TYPES; ++i) | 225 | for (i = 0; i < MAP__NR_TYPES; ++i) |
226 | symbols__delete(&self->symbols[i]); | 226 | symbols__delete(&self->symbols[i]); |
227 | if (self->long_name != self->name) | 227 | if (self->sname_alloc) |
228 | free((char *)self->short_name); | ||
229 | if (self->lname_alloc) | ||
228 | free(self->long_name); | 230 | free(self->long_name); |
229 | free(self); | 231 | free(self); |
230 | } | 232 | } |
@@ -1530,6 +1532,7 @@ static int map_groups__set_modules_path_dir(struct map_groups *self, | |||
1530 | if (long_name == NULL) | 1532 | if (long_name == NULL) |
1531 | goto failure; | 1533 | goto failure; |
1532 | dso__set_long_name(map->dso, long_name); | 1534 | dso__set_long_name(map->dso, long_name); |
1535 | map->dso->lname_alloc = 1; | ||
1533 | dso__kernel_module_get_build_id(map->dso, ""); | 1536 | dso__kernel_module_get_build_id(map->dso, ""); |
1534 | } | 1537 | } |
1535 | } | 1538 | } |
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h index 6452a07425a2..f29f73c20809 100644 --- a/tools/perf/util/symbol.h +++ b/tools/perf/util/symbol.h | |||
@@ -126,12 +126,14 @@ struct dso { | |||
126 | struct list_head node; | 126 | struct list_head node; |
127 | struct rb_root symbols[MAP__NR_TYPES]; | 127 | struct rb_root symbols[MAP__NR_TYPES]; |
128 | struct rb_root symbol_names[MAP__NR_TYPES]; | 128 | struct rb_root symbol_names[MAP__NR_TYPES]; |
129 | enum dso_kernel_type kernel; | ||
129 | u8 adjust_symbols:1; | 130 | u8 adjust_symbols:1; |
130 | u8 slen_calculated:1; | 131 | u8 slen_calculated:1; |
131 | u8 has_build_id:1; | 132 | u8 has_build_id:1; |
132 | enum dso_kernel_type kernel; | ||
133 | u8 hit:1; | 133 | u8 hit:1; |
134 | u8 annotate_warned:1; | 134 | u8 annotate_warned:1; |
135 | u8 sname_alloc:1; | ||
136 | u8 lname_alloc:1; | ||
135 | unsigned char origin; | 137 | unsigned char origin; |
136 | u8 sorted_by_name; | 138 | u8 sorted_by_name; |
137 | u8 loaded; | 139 | u8 loaded; |