summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Hervey <edward@centricular.com>2016-11-28 13:48:16 +0100
committerEdward Hervey <bilboed@bilboed.com>2016-11-28 14:02:23 +0100
commit82c871a8a34cffd58f88ddc9eb1b38638a8bf9cf (patch)
tree87d60e8e98e8a910b47257dc124d655f33062f7d
parent03cf764a00e5df00f445db7f3faee22d2b104d9a (diff)
gstutils: Fix a pad leak
When requesting a pad from a template and it's already linked, this means it was a static pad. Since we only want to return an *available* pad, we must return NULL ... but we must also remove the reference we got from getting that static pad. The "No need to unref" message (which wasn't true for quite some time) dates back from the very very very first commit introducing the 0.10 features.
-rw-r--r--gst/gstutils.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/gst/gstutils.c b/gst/gstutils.c
index bd06dcabf..379faf38b 100644
--- a/gst/gstutils.c
+++ b/gst/gstutils.c
@@ -911,10 +911,11 @@ gst_element_request_compatible_pad (GstElement * element,
templ_new = gst_element_get_compatible_pad_template (element, templ);
if (templ_new)
pad = gst_element_get_pad_from_template (element, templ_new);
-
- /* This can happen for non-request pads. No need to unref. */
- if (pad && GST_PAD_PEER (pad))
+ /* This can happen for non-request pads. */
+ if (pad && GST_PAD_PEER (pad)) {
+ gst_object_unref (pad);
pad = NULL;
+ }
return pad;
}