intel/aubinator: Free section data last

We were walking the sections, printing the batches, and then freeing
them in one pass.  If the batch happens to reference any earlier
sections (which it almost certainly will since it's at the end), we will
access freed memory.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
This commit is contained in:
Jason Ekstrand
2017-12-27 08:39:10 -08:00
parent 5c5f2eaa08
commit a92d52c3c1
+5 -3
View File
@@ -521,12 +521,14 @@ read_data_file(FILE *file)
gen_print_batch(&batch_ctx, sections[s].data, sections[s].count,
sections[s].gtt_offset);
}
free(sections[s].ring_name);
free(sections[s].data);
}
gen_batch_decode_ctx_finish(&batch_ctx);
for (int s = 0; s < sect_num; s++) {
free(sections[s].ring_name);
free(sections[s].data);
}
}
static void