From 5c5423e6eef26f27fc9a29da908ec40e0608f451 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20=C5=9Alusarz?= Date: Thu, 24 Jun 2021 13:40:11 +0200 Subject: [PATCH] intel/tools: fix potential memory leaks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CID: 1444041 CID: 1444104 Signed-off-by: Marcin Ĺšlusarz Reviewed-by: Jason Ekstrand Part-of: --- src/intel/tools/intel_dump_gpu.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/intel/tools/intel_dump_gpu.c b/src/intel/tools/intel_dump_gpu.c index c79927afefc..b3162283f94 100644 --- a/src/intel/tools/intel_dump_gpu.c +++ b/src/intel/tools/intel_dump_gpu.c @@ -459,6 +459,9 @@ maybe_init(int fd) fail_if(device == -1, "Unknown platform '%s'\n", value); device_override = true; } else if (!strcmp(key, "file")) { + free(output_filename); + if (output_file) + fclose(output_file); output_filename = strdup(value); output_file = fopen(output_filename, "w+"); fail_if(output_file == NULL,