[Mesa-dev] [PATCH 35/71] st/nine: Prevent possible crash

Axel Davy axel.davy at ens.fr
Sun Aug 16 08:27:59 PDT 2015


From: Patrick Rudolph <siro at das-labor.org>

In case NineBaseTexture9_ctor returns an error This->surfaces[l] might be NULL.

Reviewed-by: Axel Davy <axel.davy at ens.fr>
Signed-off-by: Patrick Rudolph <siro at das-labor.org>
---
 src/gallium/state_trackers/nine/texture9.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/gallium/state_trackers/nine/texture9.c b/src/gallium/state_trackers/nine/texture9.c
index af97082..bc325c1 100644
--- a/src/gallium/state_trackers/nine/texture9.c
+++ b/src/gallium/state_trackers/nine/texture9.c
@@ -229,7 +229,8 @@ NineTexture9_dtor( struct NineTexture9 *This )
     if (This->surfaces) {
         /* The surfaces should have 0 references and be unbound now. */
         for (l = 0; l <= This->base.base.info.last_level; ++l)
-            NineUnknown_Destroy(&This->surfaces[l]->base.base);
+            if (This->surfaces[l])
+                NineUnknown_Destroy(&This->surfaces[l]->base.base);
         FREE(This->surfaces);
     }
 
-- 
2.1.0



More information about the mesa-dev mailing list