Mesa (master): vc4: Return NULL when we can' t make our shadow for a sampler view.

Eric Anholt anholt at kemper.freedesktop.org
Tue Nov 10 03:22:02 UTC 2015


Module: Mesa
Branch: master
Commit: 5980389bbf98b8186ba6a06392d92b82fa9efad3
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5980389bbf98b8186ba6a06392d92b82fa9efad3

Author: Eric Anholt <eric at anholt.net>
Date:   Mon Nov  9 08:56:01 2015 -0800

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 at lists.freedesktop.org>

---

 src/gallium/drivers/vc4/vc4_state.c |    4 ++++
 1 file changed, 4 insertions(+)

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;




More information about the mesa-commit mailing list