encodebin: fix possible pad ref leak in error code path
https://bugzilla.gnome.org/show_bug.cgi?id=785065
This commit is contained in:
parent
6ccba23752
commit
3cc824c9ce
@ -1206,7 +1206,7 @@ _create_stream_group (GstEncodeBin * ebin, GstEncodingProfile * sprof,
|
|||||||
const gchar * sinkpadname, GstCaps * sinkcaps, gboolean * encoder_not_found)
|
const gchar * sinkpadname, GstCaps * sinkcaps, gboolean * encoder_not_found)
|
||||||
{
|
{
|
||||||
StreamGroup *sgroup = NULL;
|
StreamGroup *sgroup = NULL;
|
||||||
GstPad *sinkpad, *srcpad, *muxerpad = NULL;
|
GstPad *sinkpad, *srcpad = NULL, *muxerpad = NULL;
|
||||||
/* Element we will link to the encoder */
|
/* Element we will link to the encoder */
|
||||||
GstElement *last = NULL;
|
GstElement *last = NULL;
|
||||||
GstElement *encoder = NULL;
|
GstElement *encoder = NULL;
|
||||||
@ -1265,6 +1265,7 @@ _create_stream_group (GstEncodeBin * ebin, GstEncodingProfile * sprof,
|
|||||||
gst_ghost_pad_set_target (GST_GHOST_PAD (ebin->srcpad), srcpad);
|
gst_ghost_pad_set_target (GST_GHOST_PAD (ebin->srcpad), srcpad);
|
||||||
}
|
}
|
||||||
gst_object_unref (srcpad);
|
gst_object_unref (srcpad);
|
||||||
|
srcpad = NULL;
|
||||||
|
|
||||||
/* Check if we need a formatter
|
/* Check if we need a formatter
|
||||||
* If we have no muxer or
|
* If we have no muxer or
|
||||||
@ -1392,7 +1393,7 @@ _create_stream_group (GstEncodeBin * ebin, GstEncodingProfile * sprof,
|
|||||||
goto passthrough_link_failure;
|
goto passthrough_link_failure;
|
||||||
g_object_unref (sinkpad);
|
g_object_unref (sinkpad);
|
||||||
g_object_unref (srcpad);
|
g_object_unref (srcpad);
|
||||||
|
srcpad = NULL;
|
||||||
|
|
||||||
/* Path 2 : Conversion / Encoding */
|
/* Path 2 : Conversion / Encoding */
|
||||||
|
|
||||||
@ -1413,6 +1414,7 @@ _create_stream_group (GstEncodeBin * ebin, GstEncodingProfile * sprof,
|
|||||||
goto encoder_link_failure;
|
goto encoder_link_failure;
|
||||||
g_object_unref (sinkpad);
|
g_object_unref (sinkpad);
|
||||||
g_object_unref (srcpad);
|
g_object_unref (srcpad);
|
||||||
|
srcpad = NULL;
|
||||||
} else if (gst_encoding_profile_get_preset (sgroup->profile)
|
} else if (gst_encoding_profile_get_preset (sgroup->profile)
|
||||||
|| gst_encoding_profile_get_preset_name (sgroup->profile)) {
|
|| gst_encoding_profile_get_preset_name (sgroup->profile)) {
|
||||||
|
|
||||||
@ -1575,6 +1577,7 @@ _create_stream_group (GstEncodeBin * ebin, GstEncodingProfile * sprof,
|
|||||||
goto splitter_encoding_failure;
|
goto splitter_encoding_failure;
|
||||||
g_object_unref (sinkpad);
|
g_object_unref (sinkpad);
|
||||||
g_object_unref (srcpad);
|
g_object_unref (srcpad);
|
||||||
|
srcpad = NULL;
|
||||||
|
|
||||||
/* End of Stream 2 setup */
|
/* End of Stream 2 setup */
|
||||||
|
|
||||||
@ -1671,6 +1674,8 @@ cleanup:
|
|||||||
gst_caps_unref (format);
|
gst_caps_unref (format);
|
||||||
if (restriction)
|
if (restriction)
|
||||||
gst_caps_unref (restriction);
|
gst_caps_unref (restriction);
|
||||||
|
if (srcpad)
|
||||||
|
gst_object_unref (srcpad);
|
||||||
stream_group_free (ebin, sgroup);
|
stream_group_free (ebin, sgroup);
|
||||||
g_list_free (tosync);
|
g_list_free (tosync);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user