From 5c219ab55239ceef3285262ff68a502e419061e0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Thu, 10 Sep 2015 18:16:26 +0200 Subject: [PATCH] radeonsi: add malloc fail paths to si_create_shader_state MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Cc: 11.0 Acked-by: Christian König Reviewed-by: Michel Dänzer --- src/gallium/drivers/radeonsi/si_state_shaders.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c index db45cc181c6..1f1965f6a56 100644 --- a/src/gallium/drivers/radeonsi/si_state_shaders.c +++ b/src/gallium/drivers/radeonsi/si_state_shaders.c @@ -666,8 +666,16 @@ static void *si_create_shader_state(struct pipe_context *ctx, struct si_shader_selector *sel = CALLOC_STRUCT(si_shader_selector); int i; + if (!sel) + return NULL; + sel->type = pipe_shader_type; sel->tokens = tgsi_dup_tokens(state->tokens); + if (!sel->tokens) { + FREE(sel); + return NULL; + } + sel->so = state->stream_output; tgsi_scan_shader(state->tokens, &sel->info); p_atomic_inc(&sscreen->b.num_shaders_created); -- 2.30.2