{element,deviceprovider}factory: g_object_new() can't ever return NULL

So treat it as the assertion it is.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3226>
This commit is contained in:
Sebastian Dröge 2022-10-19 13:34:28 +03:00 committed by GStreamer Marge Bot
parent 4f03dbd37c
commit c7080b1626
2 changed files with 8 additions and 17 deletions

View file

@ -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;
}
}
/**

View file

@ -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;
}
}
/**