Mesa (master): intel/tools/aubinator_error_decode: fix small memory leaks

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Dec 9 12:24:32 UTC 2020


Module: Mesa
Branch: master
Commit: aff845da6709941beec96d9362972641d2c4a955
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=aff845da6709941beec96d9362972641d2c4a955

Author: Marcin Ślusarz <marcin.slusarz at intel.com>
Date:   Tue Dec  8 19:38:01 2020 +0100

intel/tools/aubinator_error_decode: fix small memory leaks

Signed-off-by: Marcin Ślusarz <marcin.slusarz at intel.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7994>

---

 src/intel/tools/aubinator_error_decode.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/intel/tools/aubinator_error_decode.c b/src/intel/tools/aubinator_error_decode.c
index ff867f24702..680bfb88f88 100644
--- a/src/intel/tools/aubinator_error_decode.c
+++ b/src/intel/tools/aubinator_error_decode.c
@@ -762,18 +762,17 @@ open_error_state_file(const char *path)
       ret = asprintf(&filename, "%s/i915_error_state", path);
       assert(ret > 0);
       file = fopen(filename, "r");
+      free(filename);
       if (!file) {
          int minor;
-         free(filename);
          for (minor = 0; minor < 64; minor++) {
             ret = asprintf(&filename, "%s/%d/i915_error_state", path, minor);
             assert(ret > 0);
 
             file = fopen(filename, "r");
+            free(filename);
             if (file)
                break;
-
-            free(filename);
          }
       }
       if (!file) {



More information about the mesa-commit mailing list