aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-record.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/builtin-record.c')
-rw-r--r--tools/perf/builtin-record.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 04f335ef9a8c..4c03bb7a4eba 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))) {