summaryrefslogtreecommitdiffstats
path: root/src/intel/tools
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-12-27 08:39:10 -0800
committerJason Ekstrand <[email protected]>2017-12-28 10:39:04 -0800
commita92d52c3c1676e25d742db387426315aee78e9f8 (patch)
treed4363be99c15bd22d76ce496eb9e722dad20ce91 /src/intel/tools
parent5c5f2eaa08fb6c1b1241c424dd4b33d326a15b7d (diff)
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 <[email protected]>
Diffstat (limited to 'src/intel/tools')
-rw-r--r--src/intel/tools/aubinator_error_decode.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/intel/tools/aubinator_error_decode.c b/src/intel/tools/aubinator_error_decode.c
index d6fbfe0eb85..9dd70790e15 100644
--- a/src/intel/tools/aubinator_error_decode.c
+++ b/src/intel/tools/aubinator_error_decode.c
@@ -521,12 +521,14 @@ read_data_file(FILE *file)
gen_print_batch(&batch_ctx, sections[s].data, sections[s].count,
sections[s].gtt_offset);
}
+ }
+
+ gen_batch_decode_ctx_finish(&batch_ctx);
+ for (int s = 0; s < sect_num; s++) {
free(sections[s].ring_name);
free(sections[s].data);
}
-
- gen_batch_decode_ctx_finish(&batch_ctx);
}
static void