glsl: return cloned signature, not the builtin one
authorIlia Mirkin <imirkin@alum.mit.edu>
Sat, 6 Feb 2016 22:08:29 +0000 (17:08 -0500)
committerIlia Mirkin <imirkin@alum.mit.edu>
Sun, 7 Feb 2016 22:23:58 +0000 (17:23 -0500)
The builtin data can get released with a glReleaseShaderCompiler call.
We're careful everywhere to clone everything that comes out of builtins
except here, where we accidentally return the signature belonging to the
builtin version, rather than the locally-cloned one.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Tested-by: Rob Herring <robh@kernel.org>
Cc: mesa-stable@lists.freedesktop.org
src/compiler/glsl/ast_function.cpp

index 0eb456a2b1f448729ef5e9be9a0d46f754b4fe48..c7fdcb243790420d21d6bb5ea48a1eb9de0207fa 100644 (file)
@@ -560,7 +560,8 @@ done:
            state->symbols->add_global_function(f);
            emit_function(state, f);
         }
-        f->add_signature(sig->clone_prototype(f, NULL));
+        sig = sig->clone_prototype(f, NULL);
+        f->add_signature(sig);
       }
    }
    return sig;