[Mesa-dev] Mesa (master): glsl_to_tgsi: fix a reference leak on an error path

Ian Romanick idr at freedesktop.org
Mon Aug 29 15:14:02 PDT 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 08/29/2011 01:31 PM, Marek Olšák wrote:
> Module: Mesa
> Branch: master
> Commit: b2064ff3115afa075021902ecd35f4a5a772dc9e
> URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b2064ff3115afa075021902ecd35f4a5a772dc9e
> 
> Author: Marek Olšák <maraeo at gmail.com>
> Date:   Thu Aug 25 04:11:05 2011 +0200
> 
> glsl_to_tgsi: fix a reference leak on an error path
> 
> ---
> 
>  src/mesa/state_tracker/st_glsl_to_tgsi.cpp |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> index 2266083..3fbb0cd 100644
> --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> @@ -5050,6 +5050,7 @@ st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog)
>              break;
>           }
>           if (!ok) {
> +            _mesa_reference_program(ctx, &linked_prog, NULL);
>              return GL_FALSE;
>           }
>        }

Won't that leave prog->_LinkedShaders[i]->Program pointing at the dead
program?  I think you want:

          if (!ok) {
+            _mesa_reference_program(ctx,
&prog->_LinkedShaders[i]->Program, NULL);
             return GL_FALSE;
          }

Right?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAk5cDyoACgkQX1gOwKyEAw8V0ACgnPyVYuPE0yTgV3Ta2ifVAP/6
HDMAoJ6vOFTy6r70v8/AGjRGshytPWAK
=+rCK
-----END PGP SIGNATURE-----


More information about the mesa-dev mailing list