Mesa (11.0): gallium/radeon: only dispose locally created target machine in radeon_llvm_compile

Emil Velikov evelikov at kemper.freedesktop.org
Fri Jan 15 14:45:18 UTC 2016


Module: Mesa
Branch: 11.0
Commit: 0c4852e667c83da7c7d0e0c3007a118b02f2f326
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0c4852e667c83da7c7d0e0c3007a118b02f2f326

Author: Nicolai Hähnle <nicolai.haehnle at amd.com>
Date:   Mon Dec 14 16:10:31 2015 -0500

gallium/radeon: only dispose locally created target machine in radeon_llvm_compile

Unify the cleanup paths of the function rather than duplicating code.

Cc: "11.0 11.1" <mesa-stable at lists.freedesktop.org>
Reviewed-by: Michel Dänzer <michel.daenzer at amd.com>
(cherry picked from commit 0a6a17b9d72c57f0840d91756924632fee91f2c2)

---

 src/gallium/drivers/radeon/radeon_llvm_emit.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/radeon/radeon_llvm_emit.c b/src/gallium/drivers/radeon/radeon_llvm_emit.c
index 1a66a55..2008799 100644
--- a/src/gallium/drivers/radeon/radeon_llvm_emit.c
+++ b/src/gallium/drivers/radeon/radeon_llvm_emit.c
@@ -194,8 +194,8 @@ unsigned radeon_llvm_compile(LLVMModuleRef M, struct radeon_shader_binary *binar
 	if (mem_err) {
 		fprintf(stderr, "%s: %s", __FUNCTION__, err);
 		FREE(err);
-		LLVMDisposeTargetMachine(tm);
-		return 1;
+		rval = 1;
+		goto out;
 	}
 
 	if (0 != rval) {
@@ -211,6 +211,7 @@ unsigned radeon_llvm_compile(LLVMModuleRef M, struct radeon_shader_binary *binar
 	/* Clean up */
 	LLVMDisposeMemoryBuffer(out_buffer);
 
+out:
 	if (dispose_tm) {
 		LLVMDisposeTargetMachine(tm);
 	}




More information about the mesa-commit mailing list