[Mesa-dev] [PATCH 10/39] st/nine: Fix leak after ctor failures

Axel Davy axel.davy at ens.fr
Sun May 15 10:45:24 UTC 2016


Previously ctor failures would not unreference
the device.

Signed-off-by: Axel Davy <axel.davy at ens.fr>
---
 src/gallium/state_trackers/nine/iunknown.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/gallium/state_trackers/nine/iunknown.c b/src/gallium/state_trackers/nine/iunknown.c
index a28c8b2..515ceaa 100644
--- a/src/gallium/state_trackers/nine/iunknown.c
+++ b/src/gallium/state_trackers/nine/iunknown.c
@@ -48,6 +48,8 @@ NineUnknown_ctor( struct NineUnknown *This,
 void
 NineUnknown_dtor( struct NineUnknown *This )
 {
+    if (This->refs && This->device) /* Possible only if early exit after a ctor failed */
+        (void) NineUnknown_Release(NineUnknown(This->device));
     FREE(This);
 }
 
-- 
2.8.2



More information about the mesa-dev mailing list