[Mesa-dev] [PATCH] mesa: Fix memory leak in _mesa_get_uniform_location.

Jose Fonseca jfonseca at vmware.com
Fri Mar 23 02:32:42 PDT 2012


Looks good.

Jose

----- Original Message -----
> Fixes Coverity resource leak defect.
> 
> NOTE: This is a candidate for the 8.0 branch.
> 
> Signed-off-by: Vinson Lee <vlee at freedesktop.org>
> ---
>  src/mesa/main/uniform_query.cpp |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/src/mesa/main/uniform_query.cpp
> b/src/mesa/main/uniform_query.cpp
> index 991df78..da41ee8 100644
> --- a/src/mesa/main/uniform_query.cpp
> +++ b/src/mesa/main/uniform_query.cpp
> @@ -905,8 +905,10 @@ _mesa_get_uniform_location(struct gl_context
> *ctx,
>        name_copy[i-1] = '\0';
>  
>        offset = strtol(&name[i], NULL, 10);
> -      if (offset < 0)
> +      if (offset < 0) {
> +	 free(name_copy);
>  	 return -1;
> +      }
>  
>        array_lookup = true;
>     } else {
> --
> 1.7.9.1
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
> 


More information about the mesa-dev mailing list