gallivm: Prevent double delete on LLVM 3.6
authorJose Fonseca <jfonseca@vmware.com>
Thu, 12 Mar 2015 09:57:43 +0000 (09:57 +0000)
committerJose Fonseca <jfonseca@vmware.com>
Thu, 12 Mar 2015 10:01:09 +0000 (10:01 +0000)
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@cvine.freeserve.co.uk>
src/gallium/auxiliary/gallivm/lp_bld_misc.cpp

index e2578cfccb8a867a6326645d0af8fe79c2fa63fe..d60db91df95044d2f018625f0e56f5dfb87ee4f3 100644 (file)
@@ -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