From: Marek Olšák Date: Thu, 10 Sep 2015 16:16:26 +0000 (+0200) Subject: radeonsi: add malloc fail paths to si_create_shader_state X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5c219ab55239ceef3285262ff68a502e419061e0;p=mesa.git radeonsi: add malloc fail paths to si_create_shader_state Cc: 11.0 Acked-by: Christian König Reviewed-by: Michel Dänzer --- 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);