[Mesa-dev] [PATCH 30/45] st/nine: Fix possible crash on error

Axel Davy axel.davy at ens.fr
Fri Jan 29 08:08:54 PST 2016


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

In case swapchain creation fails This->swapchains[i] might be NULL and
causes a crash.

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

diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c
index 325f5e8..8724136 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -460,7 +460,8 @@ NineDevice9_dtor( struct NineDevice9 *This )
 
     if (This->swapchains) {
         for (i = 0; i < This->nswapchains; ++i)
-            NineUnknown_Unbind(NineUnknown(This->swapchains[i]));
+            if (This->swapchains[i])
+                NineUnknown_Unbind(NineUnknown(This->swapchains[i]));
         FREE(This->swapchains);
     }
 
-- 
2.7.0



More information about the mesa-dev mailing list