aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/callchain.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/callchain.c')
-rw-r--r--tools/perf/util/callchain.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c
index 42922512c1c6..8b610dd9e2f6 100644
--- a/tools/perf/util/callchain.c
+++ b/tools/perf/util/callchain.c
@@ -437,7 +437,7 @@ fill_node(struct callchain_node *node, struct callchain_cursor *cursor)
437 } 437 }
438 call->ip = cursor_node->ip; 438 call->ip = cursor_node->ip;
439 call->ms.sym = cursor_node->sym; 439 call->ms.sym = cursor_node->sym;
440 call->ms.map = cursor_node->map; 440 call->ms.map = map__get(cursor_node->map);
441 441
442 if (cursor_node->branch) { 442 if (cursor_node->branch) {
443 call->branch_count = 1; 443 call->branch_count = 1;
@@ -477,6 +477,7 @@ add_child(struct callchain_node *parent,
477 477
478 list_for_each_entry_safe(call, tmp, &new->val, list) { 478 list_for_each_entry_safe(call, tmp, &new->val, list) {
479 list_del(&call->list); 479 list_del(&call->list);
480 map__zput(call->ms.map);
480 free(call); 481 free(call);
481 } 482 }
482 free(new); 483 free(new);
@@ -761,6 +762,7 @@ merge_chain_branch(struct callchain_cursor *cursor,
761 list->ms.map, list->ms.sym, 762 list->ms.map, list->ms.sym,
762 false, NULL, 0, 0); 763 false, NULL, 0, 0);
763 list_del(&list->list); 764 list_del(&list->list);
765 map__zput(list->ms.map);
764 free(list); 766 free(list);
765 } 767 }
766 768
@@ -811,7 +813,8 @@ int callchain_cursor_append(struct callchain_cursor *cursor,
811 } 813 }
812 814
813 node->ip = ip; 815 node->ip = ip;
814 node->map = map; 816 map__zput(node->map);
817 node->map = map__get(map);
815 node->sym = sym; 818 node->sym = sym;
816 node->branch = branch; 819 node->branch = branch;
817 node->nr_loop_iter = nr_loop_iter; 820 node->nr_loop_iter = nr_loop_iter;
@@ -1142,11 +1145,13 @@ static void free_callchain_node(struct callchain_node *node)
1142 1145
1143 list_for_each_entry_safe(list, tmp, &node->parent_val, list) { 1146 list_for_each_entry_safe(list, tmp, &node->parent_val, list) {
1144 list_del(&list->list); 1147 list_del(&list->list);
1148 map__zput(list->ms.map);
1145 free(list); 1149 free(list);
1146 } 1150 }
1147 1151
1148 list_for_each_entry_safe(list, tmp, &node->val, list) { 1152 list_for_each_entry_safe(list, tmp, &node->val, list) {
1149 list_del(&list->list); 1153 list_del(&list->list);
1154 map__zput(list->ms.map);
1150 free(list); 1155 free(list);
1151 } 1156 }
1152 1157
@@ -1210,6 +1215,7 @@ int callchain_node__make_parent_list(struct callchain_node *node)
1210 goto out; 1215 goto out;
1211 *new = *chain; 1216 *new = *chain;
1212 new->has_children = false; 1217 new->has_children = false;
1218 map__get(new->ms.map);
1213 list_add_tail(&new->list, &head); 1219 list_add_tail(&new->list, &head);
1214 } 1220 }
1215 parent = parent->parent; 1221 parent = parent->parent;
@@ -1230,6 +1236,7 @@ int callchain_node__make_parent_list(struct callchain_node *node)
1230out: 1236out:
1231 list_for_each_entry_safe(chain, new, &head, list) { 1237 list_for_each_entry_safe(chain, new, &head, list) {
1232 list_del(&chain->list); 1238 list_del(&chain->list);
1239 map__zput(chain->ms.map);
1233 free(chain); 1240 free(chain);
1234 } 1241 }
1235 return -ENOMEM; 1242 return -ENOMEM;