perf tools: Don't die() in perf_header__add_attr()

Propagate the errors instead, the users are the ones to decide
what to do if a library call fails.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
LKML-Reference: <1258427892-16312-1-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
Arnaldo Carvalho de Melo 2009-11-17 01:18:09 -02:00 committed by Ingo Molnar
parent 1124ba73be
commit 11deb1f9f6
3 changed files with 30 additions and 11 deletions

View file

@ -221,7 +221,10 @@ static struct perf_header_attr *get_header_attr(struct perf_event_attr *a, int n
} else {
h_attr = perf_header_attr__new(a);
if (h_attr != NULL)
perf_header__add_attr(header, h_attr);
if (perf_header__add_attr(header, h_attr) < 0) {
perf_header_attr__delete(h_attr);
h_attr = NULL;
}
}
return h_attr;