summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorGwan-gyeong Mun <[email protected]>2016-11-20 13:19:57 +0900
committerEdward O'Callaghan <[email protected]>2016-11-22 00:04:59 +1100
commit9c5b1c799073779101d358d85eff0bdc389c93fc (patch)
treea0bca90549cbbaa8ab7cb29b22cf6a382e0545f1 /src/gallium/drivers
parent0e11290ef5ffcf1d792ad7409bf726dd556e4d87 (diff)
radeonsi: Fix resource leak in gs_copy_shader allocation failure path
CID 1394028 Signed-off-by: Mun Gwan-gyeong <[email protected]> Reviewed-by: Edward O'Callaghan <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/radeonsi/si_shader.c8
1 files changed, 7 insertions, 1 deletions
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;