[Mesa-dev] [PATCH] glsl: Fix uninitialized member in ir_array_splitting_visitor.

Kenneth Graunke kenneth at whitecape.org
Wed Apr 18 19:12:57 PDT 2012


On 04/17/2012 11:49 PM, Vinson Lee wrote:
> Fix uninitialized pointer field defect reported by Coverity.
>
> Signed-off-by: Vinson Lee<vlee at freedesktop.org>
> ---
>   src/glsl/opt_array_splitting.cpp |    1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/src/glsl/opt_array_splitting.cpp b/src/glsl/opt_array_splitting.cpp
> index f11b516..99b6a22 100644
> --- a/src/glsl/opt_array_splitting.cpp
> +++ b/src/glsl/opt_array_splitting.cpp
> @@ -223,6 +223,7 @@ public:
>      ir_array_splitting_visitor(exec_list *vars)
>      {
>         this->variable_list = vars;
> +      this->mem_ctx = NULL;
>      }
>
>      virtual ~ir_array_splitting_visitor()

Initializing it to NULL would mean that we allocate a bunch of memory 
that never gets freed.  (Admittedly, using it as is, we'd crash horribly.)

But we never actually use it, so I just pushed a patch that deletes the 
field entirely.  Thanks for pointing this out.


More information about the mesa-dev mailing list