diff options
-rw-r--r-- | tools/perf/util/map.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c index ce37e95bc513..b1c475d9b240 100644 --- a/tools/perf/util/map.c +++ b/tools/perf/util/map.c | |||
@@ -348,9 +348,18 @@ struct symbol *map__find_symbol_by_name(struct map *map, const char *name, | |||
348 | return dso__find_symbol_by_name(map->dso, map->type, name); | 348 | return dso__find_symbol_by_name(map->dso, map->type, name); |
349 | } | 349 | } |
350 | 350 | ||
351 | struct map *map__clone(struct map *map) | 351 | struct map *map__clone(struct map *from) |
352 | { | 352 | { |
353 | return memdup(map, sizeof(*map)); | 353 | struct map *map = memdup(from, sizeof(*map)); |
354 | |||
355 | if (map != NULL) { | ||
356 | atomic_set(&map->refcnt, 1); | ||
357 | RB_CLEAR_NODE(&map->rb_node); | ||
358 | dso__get(map->dso); | ||
359 | map->groups = NULL; | ||
360 | } | ||
361 | |||
362 | return map; | ||
354 | } | 363 | } |
355 | 364 | ||
356 | int map__overlap(struct map *l, struct map *r) | 365 | int map__overlap(struct map *l, struct map *r) |