From 9c5b1c799073779101d358d85eff0bdc389c93fc Mon Sep 17 00:00:00 2001 From: Gwan-gyeong Mun Date: Sun, 20 Nov 2016 13:19:57 +0900 Subject: [PATCH] radeonsi: Fix resource leak in gs_copy_shader allocation failure path MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit CID 1394028 Signed-off-by: Mun Gwan-gyeong Reviewed-by: Edward O'Callaghan Reviewed-by: Marek Olšák Reviewed-by: Nicolai Hähnle --- 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 917e1484299..608cb727449 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.30.2