[Mesa-dev] [PATCH] swr: Fix resource leak in object.

Rowley, Timothy O timothy.o.rowley at intel.com
Wed May 4 12:52:00 UTC 2016


After shader compilation, the gallivm_state is owned by ShaderVariant<> and destroyed by its destructor (swr_state.h) so that the generated JIT code and gallivm_state can be freed when no longer needed.

> On May 3, 2016, at 5:45 PM, robert.foss at collabora.com wrote:
> 
> From: Robert Foss <robert.foss at collabora.com>
> 
> Make sure that memory allocated is free'd.
> Previously only the contents of the variable
> galliumvm was free'd, not the actual memory
> it points to.
> 
> Coverity: 1358907
> Signed-off-by: Robert Foss <robert.foss at collabora.com>
> ---
> src/gallium/drivers/swr/swr_shader.cpp | 1 +
> 1 file changed, 1 insertion(+)
> 
> diff --git a/src/gallium/drivers/swr/swr_shader.cpp b/src/gallium/drivers/swr/swr_shader.cpp
> index f693f51..5b1b1ee 100644
> --- a/src/gallium/drivers/swr/swr_shader.cpp
> +++ b/src/gallium/drivers/swr/swr_shader.cpp
> @@ -134,6 +134,7 @@ struct BuilderSWR : public Builder {
> 
>    ~BuilderSWR() {
>       gallivm_free_ir(gallivm);
> +      FREE(gallivm);
>    }
> 
>    struct gallivm_state *gallivm;
> -- 
> 2.5.0
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev



More information about the mesa-dev mailing list