winegstreamer: Release sink caps in the error path.

This commit is contained in:
Rémi Bernon 2024-02-16 09:33:01 +01:00 committed by Alexandre Julliard
parent a4ef56e1d9
commit 8ae8063743

View file

@ -338,7 +338,7 @@ NTSTATUS wg_transform_create(void *args)
struct wg_format output_format = *params->output_format;
struct wg_format input_format = *params->input_format;
GstElement *first = NULL, *last = NULL, *element;
GstCaps *raw_caps = NULL, *src_caps = NULL;
GstCaps *sink_caps = NULL, *src_caps = NULL;
NTSTATUS status = STATUS_UNSUCCESSFUL;
GstPadTemplate *template = NULL;
struct wg_transform *transform;
@ -395,7 +395,7 @@ NTSTATUS wg_transform_create(void *args)
* raw output media type should be enough.
*/
media_type = gst_structure_get_name(gst_caps_get_structure(transform->output_caps, 0));
if (!(raw_caps = gst_caps_new_empty_simple(media_type)))
if (!(sink_caps = gst_caps_new_empty_simple(media_type)))
goto out;
switch (input_format.major_type)
@ -408,12 +408,9 @@ NTSTATUS wg_transform_create(void *args)
case WG_MAJOR_TYPE_VIDEO_INDEO:
case WG_MAJOR_TYPE_VIDEO_WMV:
case WG_MAJOR_TYPE_VIDEO_MPEG1:
if (!(element = find_element(GST_ELEMENT_FACTORY_TYPE_DECODER, src_caps, raw_caps))
if (!(element = find_element(GST_ELEMENT_FACTORY_TYPE_DECODER, src_caps, sink_caps))
|| !append_element(transform->container, element, &first, &last))
{
gst_caps_unref(raw_caps);
goto out;
}
break;
case WG_MAJOR_TYPE_AUDIO:
@ -421,12 +418,9 @@ NTSTATUS wg_transform_create(void *args)
break;
case WG_MAJOR_TYPE_UNKNOWN:
GST_FIXME("Format %u not implemented!", input_format.major_type);
gst_caps_unref(raw_caps);
goto out;
}
gst_caps_unref(raw_caps);
switch (output_format.major_type)
{
case WG_MAJOR_TYPE_AUDIO:
@ -507,6 +501,7 @@ NTSTATUS wg_transform_create(void *args)
goto out;
gst_caps_unref(src_caps);
gst_caps_unref(sink_caps);
GST_INFO("Created winegstreamer transform %p.", transform);
params->transform = (wg_transform_t)(ULONG_PTR)transform;
@ -521,6 +516,8 @@ out:
gst_object_unref(transform->my_src);
if (src_caps)
gst_caps_unref(src_caps);
if (sink_caps)
gst_caps_unref(sink_caps);
if (transform->allocator)
wg_allocator_destroy(transform->allocator);
if (transform->drain_query)