[Mesa-dev] [PATCH 3/6] st/nine: Fix volumetexture dtor on ctor failure

Axel Davy davyaxel0 at gmail.com
Sun Dec 16 21:25:02 UTC 2018


The dtor is called on allocation failure,
thus we must check the volumes are allocated
before trying to release them.

Signed-off-by: Axel Davy <davyaxel0 at gmail.com>
Cc: mesa-stable at lists.freedesktop.org
---
 src/gallium/state_trackers/nine/volumetexture9.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/gallium/state_trackers/nine/volumetexture9.c b/src/gallium/state_trackers/nine/volumetexture9.c
index 5dec4844864..c7191bce688 100644
--- a/src/gallium/state_trackers/nine/volumetexture9.c
+++ b/src/gallium/state_trackers/nine/volumetexture9.c
@@ -141,7 +141,8 @@ NineVolumeTexture9_dtor( struct NineVolumeTexture9 *This )
 
     if (This->volumes) {
         for (l = 0; l <= This->base.base.info.last_level; ++l)
-            NineUnknown_Destroy(&This->volumes[l]->base);
+            if (This->volumes[l])
+                NineUnknown_Destroy(&This->volumes[l]->base);
         FREE(This->volumes);
     }
 
-- 
2.19.2



More information about the mesa-dev mailing list