[Mesa-dev] [PATCH] st/vega: Fix memory leak in combine_shaders.

Brian Paul brianp at vmware.com
Sun Feb 24 08:08:09 PST 2013


On 02/23/2013 06:16 PM, Vinson Lee wrote:
> Fixes resource leak defect reported by Coverity.
>
> Signed-off-by: Vinson Lee<vlee at freedesktop.org>
> ---
>   src/gallium/state_trackers/vega/shaders_cache.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/src/gallium/state_trackers/vega/shaders_cache.c b/src/gallium/state_trackers/vega/shaders_cache.c
> index eceae54..c1082ca 100644
> --- a/src/gallium/state_trackers/vega/shaders_cache.c
> +++ b/src/gallium/state_trackers/vega/shaders_cache.c
> @@ -225,8 +225,10 @@ combine_shaders(const struct shader_asm_info *shaders[SHADER_STAGES], int num_sh
>      ureg_END(ureg);
>
>      shader->tokens = ureg_finalize(ureg);
> -   if(!shader->tokens)
> +   if (!shader->tokens) {
> +      ureg_destroy(ureg);
>         return NULL;
> +   }
>
>      p = pipe->create_fs_state(pipe, shader);
>

Reviewed-by: Brian Paul <brianp at vmware.com>


More information about the mesa-dev mailing list