gallium/radeon: only dispose locally created target machine in radeon_llvm_compile
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Mon, 14 Dec 2015 21:10:31 +0000 (16:10 -0500)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Fri, 18 Dec 2015 17:17:40 +0000 (12:17 -0500)
Unify the cleanup paths of the function rather than duplicating code.

Cc: "11.0 11.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
src/gallium/drivers/radeon/radeon_llvm_emit.c

index 6b2ebdead38247e518f52714283d03049355d1ee..61ed94021224e1c4226960cf799c4d073847fe7d 100644 (file)
@@ -188,8 +188,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) {
@@ -205,6 +205,7 @@ unsigned radeon_llvm_compile(LLVMModuleRef M, struct radeon_shader_binary *binar
        /* Clean up */
        LLVMDisposeMemoryBuffer(out_buffer);
 
+out:
        if (dispose_tm) {
                LLVMDisposeTargetMachine(tm);
        }