[Mesa-dev] [PATCH] radeonsi: Fix resource leak in gs_copy_shader allocation failure path

Edward O'Callaghan funfunctor at folklore1984.net
Sun Nov 20 10:10:01 UTC 2016


Reviewed-by: Edward O'Callaghan <funfunctor at folklore1984.net>

On 11/20/2016 03:19 PM, Mun Gwan-gyeong wrote:
> CID 1394028
> 
> Signed-off-by: Mun Gwan-gyeong <elongbug at gmail.com>
> ---
>  src/gallium/drivers/radeonsi/si_shader.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
> index 917e148..608cb72 100644
> --- a/src/gallium/drivers/radeonsi/si_shader.c
> +++ b/src/gallium/drivers/radeonsi/si_shader.c
> @@ -6137,9 +6137,15 @@ si_generate_gs_copy_shader(struct si_screen *sscreen,
>  
>  	outputs = MALLOC(gsinfo->num_outputs * sizeof(outputs[0]));
>  
> +	if (!outputs)
> +		return NULL;
> +
>  	shader = CALLOC_STRUCT(si_shader);
> -	if (!shader)
> +	if (!shader) {
> +		FREE(outputs);
>  		return NULL;
> +	}
> +
>  
>  	shader->selector = gs_selector;
>  	shader->is_gs_copy_shader = true;
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20161120/6528b1ef/attachment.sig>


More information about the mesa-dev mailing list