Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 169638
b: refs/heads/master
c: a9a70bb
h: refs/heads/master
v: v3
  • Loading branch information
Arnaldo Carvalho de Melo authored and Ingo Molnar committed Nov 17, 2009
1 parent bbdcd05 commit 674bdab
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5875412152ce67fb5087157b86ab6597f91d23e8
refs/heads/master: a9a70bbce7ab0bf3b1cba3ac662c4d502da6305c
5 changes: 5 additions & 0 deletions trunk/tools/perf/builtin-record.c
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,11 @@ static int __cmd_record(int argc, const char **argv)
else
header = perf_header__new();

if (header == NULL) {
pr_err("Not enough memory for reading perf file header\n");
return -1;
}

if (raw_samples) {
perf_header__set_feat(header, HEADER_TRACE_INFO);
} else {
Expand Down
18 changes: 11 additions & 7 deletions trunk/tools/perf/util/header.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,15 @@ struct perf_header *perf_header__new(void)
{
struct perf_header *self = calloc(sizeof(*self), 1);

if (!self)
die("nomem");

self->size = 1;
self->attr = malloc(sizeof(void *));
if (self != NULL) {
self->size = 1;
self->attr = malloc(sizeof(void *));

if (!self->attr)
die("nomem");
if (self->attr == NULL) {
free(self);
self = NULL;
}
}

return self;
}
Expand Down Expand Up @@ -426,6 +427,9 @@ struct perf_header *perf_header__read(int fd)
u64 f_id;
int nr_attrs, nr_ids, i, j;

if (self == NULL)
die("nomem");

if (perf_file_header__read(&f_header, self, fd) < 0)
die("incompatible file format");

Expand Down

0 comments on commit 674bdab

Please sign in to comment.