Mesa (master): gallivm: Prevent double delete on LLVM 3.6

Jose Fonseca jrfonseca at kemper.freedesktop.org
Thu Mar 12 10:02:08 UTC 2015


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

Author: Jose Fonseca <jfonseca at vmware.com>
Date:   Thu Mar 12 09:57:43 2015 +0000

gallivm: Prevent double delete on LLVM 3.6

std::unique_ptr takes ownership of MM, and a double delete could ensure
in case of an error,  as pointed out by Chris Vine in
https://bugs.freedesktop.org/show_bug.cgi?id=89387

Reviewed-by: Chris Vine <chris at cvine.freeserve.co.uk>

---

 src/gallium/auxiliary/gallivm/lp_bld_misc.cpp |    1 +
 1 file changed, 1 insertion(+)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
index e2578cf..d60db91 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
+++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
@@ -502,6 +502,7 @@ lp_build_create_jit_compiler_for_module(LLVMExecutionEngineRef *OutJIT,
 
 #if HAVE_LLVM >= 0x0306
        builder.setMCJITMemoryManager(std::unique_ptr<RTDyldMemoryManager>(MM));
+       MM = NULL; // onwership taken by std::unique_ptr
 #else
        builder.setMCJITMemoryManager(MM);
 #endif




More information about the mesa-commit mailing list