summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2015-09-10 18:16:26 +0200
committerMarek Olšák <[email protected]>2015-09-24 19:51:42 +0200
commit5c219ab55239ceef3285262ff68a502e419061e0 (patch)
treea26d62211dd1cdeb66ee3816735ff825896aa6af /src
parent394d67a58f949245e8b3fad400e9efaa5829ec84 (diff)
radeonsi: add malloc fail paths to si_create_shader_state
Cc: 11.0 <[email protected]> Acked-by: Christian König <[email protected]> Reviewed-by: Michel Dänzer <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/radeonsi/si_state_shaders.c8
1 files changed, 8 insertions, 0 deletions
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);