[Mesa-dev] [PATCH 07/20] glsl: Add null check in loop_analysis.cpp

Ian Romanick idr at freedesktop.org
Wed May 14 13:06:58 PDT 2014


Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

On 05/14/2014 10:55 AM, Juha-Pekka Heikkila wrote:
> Check return value from hash_table_find before using it as a pointer
> 
> Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
> ---
>  src/glsl/loop_analysis.cpp | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/src/glsl/loop_analysis.cpp b/src/glsl/loop_analysis.cpp
> index d6a9ac7..78ac300 100644
> --- a/src/glsl/loop_analysis.cpp
> +++ b/src/glsl/loop_analysis.cpp
> @@ -589,8 +589,10 @@ get_basic_induction_increment(ir_assignment *ir, hash_table *var_hash)
>  	 loop_variable *lv =
>  	    (loop_variable *) hash_table_find(var_hash, inc_var);
>  
> -	 if (!lv->is_loop_constant())
> -	    inc = NULL;
> +         if (lv == NULL || !lv->is_loop_constant()) {
> +            assert(lv != NULL);
> +            inc = NULL;
> +         }
>        } else
>  	 inc = NULL;
>     }
> 



More information about the mesa-dev mailing list