aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/perf/builtin-report.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 1cae87713792..3a70c5807c04 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -83,7 +83,7 @@ static int perf_session__add_hist_entry(struct perf_session *self,
83 struct map_symbol *syms = NULL; 83 struct map_symbol *syms = NULL;
84 struct symbol *parent = NULL; 84 struct symbol *parent = NULL;
85 bool hit; 85 bool hit;
86 int err; 86 int err = -ENOMEM;
87 struct hist_entry *he; 87 struct hist_entry *he;
88 struct event_stat_id *stats; 88 struct event_stat_id *stats;
89 struct perf_event_attr *attr; 89 struct perf_event_attr *attr;
@@ -101,26 +101,24 @@ static int perf_session__add_hist_entry(struct perf_session *self,
101 else 101 else
102 stats = get_stats(self, data->id, 0, 0); 102 stats = get_stats(self, data->id, 0, 0);
103 if (stats == NULL) 103 if (stats == NULL)
104 return -ENOMEM; 104 goto out_free_syms;
105 he = __perf_session__add_hist_entry(&stats->hists, al, parent, 105 he = __perf_session__add_hist_entry(&stats->hists, al, parent,
106 data->period, &hit); 106 data->period, &hit);
107 if (he == NULL) 107 if (he == NULL)
108 return -ENOMEM; 108 goto out_free_syms;
109 109
110 if (hit) 110 if (hit)
111 __perf_session__add_count(he, al, data->period); 111 __perf_session__add_count(he, al, data->period);
112 112
113 err = 0;
113 if (symbol_conf.use_callchain) { 114 if (symbol_conf.use_callchain) {
114 if (!hit) 115 if (!hit)
115 callchain_init(he->callchain); 116 callchain_init(he->callchain);
116 err = append_chain(he->callchain, data->callchain, syms); 117 err = append_chain(he->callchain, data->callchain, syms);
117 free(syms);
118
119 if (err)
120 return err;
121 } 118 }
122 119out_free_syms:
123 return 0; 120 free(syms);
121 return err;
124} 122}
125 123
126static int add_event_total(struct perf_session *session, 124static int add_event_total(struct perf_session *session,