mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-31 03:29:50 +00:00
{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:
parent
4f03dbd37c
commit
c7080b1626
2 changed files with 8 additions and 17 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue