summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2015-11-09 08:56:01 -0800
committerEric Anholt <eric@anholt.net>2015-11-09 19:17:36 -0800
commit5980389bbf98b8186ba6a06392d92b82fa9efad3 (patch)
treea2a8b6b928de4f861fc235295085f55231d470eb
parenteb8fb0064dbde7a363c2f99466a51b346b09a029 (diff)
downloadexternal_mesa3d-5980389bbf98b8186ba6a06392d92b82fa9efad3.zip
external_mesa3d-5980389bbf98b8186ba6a06392d92b82fa9efad3.tar.gz
external_mesa3d-5980389bbf98b8186ba6a06392d92b82fa9efad3.tar.bz2
vc4: Return NULL when we can't make our shadow for a sampler view.
I'm not sure what the caller does is appropriate (just have a NULL sampler at this slot), but it fixes the immediate crash. Cc: "11.0" <mesa-stable@lists.freedesktop.org>
-rw-r--r--src/gallium/drivers/vc4/vc4_state.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/gallium/drivers/vc4/vc4_state.c b/src/gallium/drivers/vc4/vc4_state.c
index 78aa344..7317695 100644
--- a/src/gallium/drivers/vc4/vc4_state.c
+++ b/src/gallium/drivers/vc4/vc4_state.c
@@ -583,6 +583,10 @@ vc4_create_sampler_view(struct pipe_context *pctx, struct pipe_resource *prsc,
tmpl.last_level = cso->u.tex.last_level - cso->u.tex.first_level;
prsc = vc4_resource_create(pctx->screen, &tmpl);
+ if (!prsc) {
+ free(so);
+ return NULL;
+ }
rsc = vc4_resource(prsc);
clone = vc4_resource(prsc);
clone->shadow_parent = &shadow_parent->base.b;