deviceproviderfactory: fix factory leak
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Mon, 2 May 2016 14:00:42 +0000 (16:00 +0200)
committerSebastian Dröge <sebastian@centricular.com>
Tue, 3 May 2016 07:49:24 +0000 (10:49 +0300)
The code path when early returning was leaking the extra reference on
the factory.

https://bugzilla.gnome.org/show_bug.cgi?id=765904

gst/gstdeviceproviderfactory.c

index a28a0bd..2257ad7 100644 (file)
@@ -275,8 +275,10 @@ gst_device_provider_factory_get (GstDeviceProviderFactory * factory)
     goto no_type;
 
   device_provider = g_atomic_pointer_get (&newfactory->provider);
-  if (device_provider)
+  if (device_provider) {
+    gst_object_unref (factory);
     return gst_object_ref (device_provider);
+  }
 
   /* create an instance of the device provider, cast so we don't assert on NULL
    * also set name as early as we can