diff options
author | Lionel Landwerlin <[email protected]> | 2018-07-18 17:39:19 +0100 |
---|---|---|
committer | Lionel Landwerlin <[email protected]> | 2018-07-19 20:11:56 +0100 |
commit | 0f9d8b754f56fd2aaab5599a43cefe6b1ff88519 (patch) | |
tree | 0727d1301ee4c303f1f510e118e787b02c72d03b /src/intel | |
parent | 3d41757788aca774e64297bed962696cc0c9b262 (diff) |
intel: tools: aubwrite: fix invalid frees on finish
Signed-off-by: Lionel Landwerlin <[email protected]>
Reviewed-by: Jordan Justen <[email protected]>
Diffstat (limited to 'src/intel')
-rw-r--r-- | src/intel/tools/aub_write.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/intel/tools/aub_write.c b/src/intel/tools/aub_write.c index 07f38b97d4e..6fb99feb005 100644 --- a/src/intel/tools/aub_write.c +++ b/src/intel/tools/aub_write.c @@ -255,11 +255,16 @@ align_u32(uint32_t v, uint32_t a) } static void -aub_ppgtt_table_finish(struct aub_ppgtt_table *table) +aub_ppgtt_table_finish(struct aub_ppgtt_table *table, int level) { + if (level == 1) + return; + for (unsigned i = 0; i < ARRAY_SIZE(table->subtables); i++) { - aub_ppgtt_table_finish(table->subtables[i]); - free(table->subtables[i]); + if (table->subtables[i]) { + aub_ppgtt_table_finish(table->subtables[i], level - 1); + free(table->subtables[i]); + } } } @@ -280,7 +285,7 @@ aub_file_init(struct aub_file *aub, FILE *file, uint16_t pci_id) void aub_file_finish(struct aub_file *aub) { - aub_ppgtt_table_finish(&aub->pml4); + aub_ppgtt_table_finish(&aub->pml4, 4); fclose(aub->file); } |