diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2009-11-16 16:30:26 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-11-17 01:19:52 -0500 |
commit | dc79c0fc08a94b857aed446bfb47cdfde529400c (patch) | |
tree | a68f563cf3e4a047e1948d0735de9b5991166e4d /tools/perf/builtin-record.c | |
parent | c34984b2bbc77596c97c333539bffc90d2033178 (diff) |
perf tools: Don't die in perf_header_attr__new()
We really should propagate such kinds of errors so that users of
these library functions decide what to do in such cases instead
of exiting in random places like now.
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: <1258407027-384-1-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/builtin-record.c')
-rw-r--r-- | tools/perf/builtin-record.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 04f335ef9a8..4c03bb7a4eb 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -220,7 +220,8 @@ static struct perf_header_attr *get_header_attr(struct perf_event_attr *a, int n | |||
220 | h_attr = header->attr[nr]; | 220 | h_attr = header->attr[nr]; |
221 | } else { | 221 | } else { |
222 | h_attr = perf_header_attr__new(a); | 222 | h_attr = perf_header_attr__new(a); |
223 | perf_header__add_attr(header, h_attr); | 223 | if (h_attr != NULL) |
224 | perf_header__add_attr(header, h_attr); | ||
224 | } | 225 | } |
225 | 226 | ||
226 | return h_attr; | 227 | return h_attr; |
@@ -308,6 +309,8 @@ try_again: | |||
308 | } | 309 | } |
309 | 310 | ||
310 | h_attr = get_header_attr(attr, counter); | 311 | h_attr = get_header_attr(attr, counter); |
312 | if (h_attr == NULL) | ||
313 | die("nomem\n"); | ||
311 | 314 | ||
312 | if (!file_new) { | 315 | if (!file_new) { |
313 | if (memcmp(&h_attr->attr, attr, sizeof(*attr))) { | 316 | if (memcmp(&h_attr->attr, attr, sizeof(*attr))) { |