[Mesa-dev] [PATCH] glsl: fix deref_hash memory leak in constant_expression_value

Kenneth Graunke kenneth at whitecape.org
Wed Jun 6 00:34:33 CEST 2012


On 06/05/2012 02:50 PM, Marcin Slusarz wrote:
> 
> ---
>  src/glsl/ir_constant_expression.cpp |    7 +++++--
>  1 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp
> index 08a3328..0713fd7 100644
> --- a/src/glsl/ir_constant_expression.cpp
> +++ b/src/glsl/ir_constant_expression.cpp
> @@ -1275,8 +1275,11 @@ ir_function_signature::constant_expression_value(exec_list *actual_parameters, s
>  
>     foreach_list(n, actual_parameters) {
>        ir_constant *constant = ((ir_rvalue *) n)->constant_expression_value(variable_context);
> -      if (constant == NULL)
> -	 return NULL;
> +      if (constant == NULL) {
> +         hash_table_dtor(deref_hash);
> +         return NULL;
> +      }
> +
>  
>        ir_variable *var = (ir_variable *)parameter_info;
>        hash_table_insert(deref_hash, constant, var);

Oops...thanks.

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>


More information about the mesa-dev mailing list