perf session: Remove one more exit() call from library code

Return NULL instead and make the caller propagate the error.

LKML-Reference: <new-submission>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent b9fb9304
......@@ -89,9 +89,12 @@ static int perf_session__add_hist_entry(struct perf_session *self,
struct event_stat_id *stats;
struct perf_event_attr *attr;
if ((sort__has_parent || symbol_conf.use_callchain) && data->callchain)
if ((sort__has_parent || symbol_conf.use_callchain) && data->callchain) {
syms = perf_session__resolve_callchain(self, al->thread,
data->callchain, &parent);
if (syms == NULL)
return -ENOMEM;
}
attr = perf_header__find_attr(data->id, &self->header);
if (attr)
......
......@@ -118,16 +118,11 @@ struct map_symbol *perf_session__resolve_callchain(struct perf_session *self,
struct symbol **parent)
{
u8 cpumode = PERF_RECORD_MISC_USER;
struct map_symbol *syms = NULL;
unsigned int i;
struct map_symbol *syms = calloc(chain->nr, sizeof(*syms));
if (symbol_conf.use_callchain) {
syms = calloc(chain->nr, sizeof(*syms));
if (!syms) {
fprintf(stderr, "Can't allocate memory for symbols\n");
exit(-1);
}
}
if (!syms)
return NULL;
for (i = 0; i < chain->nr; i++) {
u64 ip = chain->ips[i];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment