mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-30 04:45:36 +00:00
autoconvert: Fix some more leaks and reorganize unref code
This commit is contained in:
parent
f0ebcba6c4
commit
825052ba3d
1 changed files with 11 additions and 3 deletions
|
@ -547,8 +547,8 @@ gst_auto_convert_add_element (GstAutoConvert * autoconvert,
|
||||||
GstElement *element = NULL;
|
GstElement *element = NULL;
|
||||||
GstPad *internal_sinkpad = NULL;
|
GstPad *internal_sinkpad = NULL;
|
||||||
GstPad *internal_srcpad = NULL;
|
GstPad *internal_srcpad = NULL;
|
||||||
GstPad *sinkpad;
|
GstPad *sinkpad = NULL;
|
||||||
GstPad *srcpad;
|
GstPad *srcpad = NULL;
|
||||||
GstPadLinkReturn padlinkret;
|
GstPadLinkReturn padlinkret;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (autoconvert, "Adding element %s to the autoconvert bin",
|
GST_DEBUG_OBJECT (autoconvert, "Adding element %s to the autoconvert bin",
|
||||||
|
@ -576,7 +576,6 @@ gst_auto_convert_add_element (GstAutoConvert * autoconvert,
|
||||||
if (!sinkpad) {
|
if (!sinkpad) {
|
||||||
GST_ERROR_OBJECT (autoconvert, "Could not find sink in %s",
|
GST_ERROR_OBJECT (autoconvert, "Could not find sink in %s",
|
||||||
GST_OBJECT_NAME (element));
|
GST_OBJECT_NAME (element));
|
||||||
gst_object_unref (srcpad);
|
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -588,6 +587,10 @@ gst_auto_convert_add_element (GstAutoConvert * autoconvert,
|
||||||
|
|
||||||
if (!internal_sinkpad || !internal_srcpad) {
|
if (!internal_sinkpad || !internal_srcpad) {
|
||||||
GST_ERROR_OBJECT (autoconvert, "Could not create internal pads");
|
GST_ERROR_OBJECT (autoconvert, "Could not create internal pads");
|
||||||
|
if (internal_srcpad)
|
||||||
|
gst_object_unref (internal_srcpad);
|
||||||
|
if (internal_sinkpad)
|
||||||
|
gst_object_unref (internal_sinkpad);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -661,6 +664,11 @@ gst_auto_convert_add_element (GstAutoConvert * autoconvert,
|
||||||
error:
|
error:
|
||||||
gst_bin_remove (GST_BIN (autoconvert), element);
|
gst_bin_remove (GST_BIN (autoconvert), element);
|
||||||
|
|
||||||
|
if (srcpad)
|
||||||
|
gst_object_unref (srcpad);
|
||||||
|
if (sinkpad)
|
||||||
|
gst_object_unref (sinkpad);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue