intel/tools: fix resource leak
authorAndrii Simiklit <andrii.simiklit@globallogic.com>
Fri, 26 Oct 2018 14:29:34 +0000 (17:29 +0300)
committerLionel Landwerlin <lionel.g.landwerlin@intel.com>
Thu, 1 Nov 2018 13:21:07 +0000 (13:21 +0000)
Some memory and file descriptors are not freed/closed.

v2: fixed case where we skipped the 'aub' variable initialization

Signed-off-by: Andrii Simiklit <andrii.simiklit@globallogic.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
src/intel/tools/error2aub.c

index b6e056cbcdefd7764a123702aa8f28bd2cc435ae..fb4b4ffcfc6ce0262b8709a452973be0d9154115 100644 (file)
@@ -327,6 +327,16 @@ main(int argc, char *argv[])
 
    aub_write_exec(&aub, batch_addr, aub_gtt_size(&aub), I915_EXEC_RENDER);
 
+   free(out_filename);
+   free(line);
+   if(err_file) {
+      fclose(err_file);
+   }
+   if(aub.file) {
+      aub_file_finish(&aub);
+   } else if(aub_file) {
+      fclose(aub_file);
+   }
    return EXIT_SUCCESS;
 }