[Mesa-dev] [PATCH] radeonsi: Fix resource leak in gs_copy_shader allocation failure path
Marek Olšák
maraeo at gmail.com
Sun Nov 20 15:57:02 UTC 2016
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Marek
On Sun, Nov 20, 2016 at 5:19 AM, Mun Gwan-gyeong <elongbug at gmail.com> 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;
> --
> 2.10.2
>
> _______________________________________________
> 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