aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2009-12-31 00:05:09 -0500
committerSteven Rostedt <rostedt@goodmis.org>2009-12-31 00:05:09 -0500
commit90271c9b51376263752098b27c2f87a77c64e71a (patch)
tree0ce91795c48f654aefa94bbc955997f562ca2617
parent3651f25a761c1ea0019ede26200fcc38c6f44a33 (diff)
trace-cmd: Always initialize cpu_data list
Always intialize the cpu_data list event if the cpu data is empty. The list may still be referenced, and it will segfault if the list is not initialized. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r--trace-input.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/trace-input.c b/trace-input.c
index 239fb86..26f6373 100644
--- a/trace-input.c
+++ b/trace-input.c
@@ -1341,13 +1341,13 @@ static int init_cpu(struct tracecmd_input *handle, int cpu)
1341 cpu_data->size = cpu_data->file_size; 1341 cpu_data->size = cpu_data->file_size;
1342 cpu_data->timestamp = 0; 1342 cpu_data->timestamp = 0;
1343 1343
1344 list_head_init(&cpu_data->pages);
1345
1344 if (!cpu_data->size) { 1346 if (!cpu_data->size) {
1345 printf("CPU %d is empty\n", cpu); 1347 printf("CPU %d is empty\n", cpu);
1346 return 0; 1348 return 0;
1347 } 1349 }
1348 1350
1349 list_head_init(&cpu_data->pages);
1350
1351 cpu_data->page = allocate_page(handle, cpu, cpu_data->offset); 1351 cpu_data->page = allocate_page(handle, cpu, cpu_data->offset);
1352 if (!cpu_data->page && !handle->read_page) { 1352 if (!cpu_data->page && !handle->read_page) {
1353 perror("mmap"); 1353 perror("mmap");