deviceproviderfactory: fix factory leak

The code path when early returning was leaking the extra reference on
the factory.

https://bugzilla.gnome.org/show_bug.cgi?id=765904
This commit is contained in:
Guillaume Desmottes 2016-05-02 16:00:42 +02:00 committed by Sebastian Dröge
parent c7bb52934e
commit 782bc97e6f

View file

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