From ea176f3865d379abc01662b5f7907820709b1614 Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Thu, 10 Apr 2014 13:28:30 +0100 Subject: [PATCH] encodebin: guard against gst_pad_get_peer returning NULL If it does, the pad may be leaked if it's a request pad, though. Coverity 1139799 --- gst/encoding/gstencodebin.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/gst/encoding/gstencodebin.c b/gst/encoding/gstencodebin.c index 11c0a46..6728e58 100644 --- a/gst/encoding/gstencodebin.c +++ b/gst/encoding/gstencodebin.c @@ -1890,13 +1890,15 @@ stream_group_free (GstEncodeBin * ebin, StreamGroup * sgroup) tmppad = gst_element_get_static_pad (sgroup->outqueue, "src"); pad = gst_pad_get_peer (tmppad); - /* Remove muxer request sink pad */ - gst_pad_unlink (tmppad, pad); - if (GST_PAD_TEMPLATE_PRESENCE (GST_PAD_PAD_TEMPLATE (pad)) == - GST_PAD_REQUEST) - gst_element_release_request_pad (ebin->muxer, pad); + if (pad) { + /* Remove muxer request sink pad */ + gst_pad_unlink (tmppad, pad); + if (GST_PAD_TEMPLATE_PRESENCE (GST_PAD_PAD_TEMPLATE (pad)) == + GST_PAD_REQUEST) + gst_element_release_request_pad (ebin->muxer, pad); + gst_object_unref (pad); + } gst_object_unref (tmppad); - gst_object_unref (pad); } if (sgroup->outqueue) gst_element_set_state (sgroup->outqueue, GST_STATE_NULL); -- 2.7.4