Mesa (master): intel/tools: fix possible memory leak in the error path

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Sep 10 12:27:51 UTC 2020


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

Author: Marcin Ślusarz <marcin.slusarz at intel.com>
Date:   Wed Sep  9 18:45:08 2020 +0200

intel/tools: fix possible memory leak in the error path

Found by Coverity.

Signed-off-by: Marcin Ślusarz <marcin.slusarz at intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6667>

---

 src/intel/tools/i965_disasm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/intel/tools/i965_disasm.c b/src/intel/tools/i965_disasm.c
index a2f7b8564d6..401ca860cb4 100644
--- a/src/intel/tools/i965_disasm.c
+++ b/src/intel/tools/i965_disasm.c
@@ -103,6 +103,7 @@ i965_disasm_read_binary(FILE *fp, size_t *end)
 
    size = fread(assembly, *end, 1, fp);
    if (!size) {
+      free(assembly);
       return NULL;
    }
    return assembly;



More information about the mesa-commit mailing list