st/nine: Fix leak after ctor failures
authorAxel Davy <axel.davy@ens.fr>
Fri, 12 Feb 2016 18:08:42 +0000 (19:08 +0100)
committerAxel Davy <axel.davy@ens.fr>
Wed, 18 May 2016 21:37:14 +0000 (23:37 +0200)
Previously ctor failures would not unreference
the device.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
src/gallium/state_trackers/nine/iunknown.c

index a28c8b2de8b6e78fb58a3d029afe373032106d11..515ceaa263f38ad4f1de6d6fd9c60c510bcbfebd 100644 (file)
@@ -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);
 }