[Mesa-dev] [PATCH] glsl: Initialize ir_texture member variable.

Kenneth Graunke kenneth at whitecape.org
Mon Feb 11 23:28:22 PST 2013


On 02/11/2013 10:46 PM, Vinson Lee wrote:
> Fixes uninitialized pointer field defect reported by Coverity.
>
> Signed-off-by: Vinson Lee <vlee at freedesktop.org>
> ---
>   src/glsl/ir.h | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/glsl/ir.h b/src/glsl/ir.h
> index efd80da..1e09988 100644
> --- a/src/glsl/ir.h
> +++ b/src/glsl/ir.h
> @@ -1448,8 +1448,8 @@ enum ir_texture_opcode {
>   class ir_texture : public ir_rvalue {
>   public:
>      ir_texture(enum ir_texture_opcode op)
> -      : op(op), coordinate(NULL), projector(NULL), shadow_comparitor(NULL),
> -        offset(NULL)
> +      : op(op), sampler(NULL), coordinate(NULL), projector(NULL),
> +        shadow_comparitor(NULL), offset(NULL)
>      {
>         this->ir_type = ir_type_texture;
>      }

I think every user of this calls the set_sampler() method, which 
initalizes it.  (Otherwise it'd be pretty catastrophically broken.)

But initializing it to NULL is a good safe practice, so:

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

Thanks Vinson.


More information about the mesa-dev mailing list