diff --git a/subprojects/gstreamer/gst/gstdeviceproviderfactory.c b/subprojects/gstreamer/gst/gstdeviceproviderfactory.c index 13703bae01..8f54f88381 100644 --- a/subprojects/gstreamer/gst/gstdeviceproviderfactory.c +++ b/subprojects/gstreamer/gst/gstdeviceproviderfactory.c @@ -283,8 +283,10 @@ gst_device_provider_factory_get (GstDeviceProviderFactory * factory) * also set name as early as we can */ device_provider = g_object_new (factory->type, NULL); - if (G_UNLIKELY (device_provider == NULL)) - goto no_device_provider; + if (G_UNLIKELY (!device_provider)) { + gst_object_unref (factory); + g_return_val_if_fail (device_provider != NULL, NULL); + } /* fill in the pointer to the factory in the device provider class. The * class will not be unreffed currently. @@ -328,12 +330,6 @@ no_type: gst_object_unref (factory); return NULL; } -no_device_provider: - { - GST_WARNING_OBJECT (factory, "could not create device provider"); - gst_object_unref (factory); - return NULL; - } } /** diff --git a/subprojects/gstreamer/gst/gstelementfactory.c b/subprojects/gstreamer/gst/gstelementfactory.c index b94b576aa7..ea3427abb3 100644 --- a/subprojects/gstreamer/gst/gstelementfactory.c +++ b/subprojects/gstreamer/gst/gstelementfactory.c @@ -493,9 +493,10 @@ gst_element_factory_create_with_properties (GstElementFactory * factory, element = (GstElement *) g_object_new_with_properties (factory->type, n, names, values); - - if (G_UNLIKELY (element == NULL)) - goto no_element; + if (G_UNLIKELY (!element)) { + gst_object_unref (factory); + g_return_val_if_fail (element != NULL, NULL); + } /* fill in the pointer to the factory in the element class. The * class will not be unreffed currently. @@ -535,12 +536,6 @@ no_type: gst_object_unref (factory); return NULL; } -no_element: - { - GST_WARNING_OBJECT (factory, "could not create element"); - gst_object_unref (factory); - return NULL; - } } /**