Mesa (main): intel/tools: fix potential memory leaks

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jun 28 09:43:53 UTC 2021


Module: Mesa
Branch: main
Commit: 5c5423e6eef26f27fc9a29da908ec40e0608f451
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5c5423e6eef26f27fc9a29da908ec40e0608f451

Author: Marcin Ślusarz <marcin.slusarz at intel.com>
Date:   Thu Jun 24 13:40:11 2021 +0200

intel/tools: fix potential memory leaks

CID: 1444041
CID: 1444104

Signed-off-by: Marcin Ślusarz <marcin.slusarz at intel.com>
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11574>

---

 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,



More information about the mesa-commit mailing list