From c815b879fe0a41a807c7a4a5dacc8c1f9732679b Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 17 Mar 2006 19:27:51 +0000 Subject: [PATCH] gst/gstpad.c: Don't leak buffers, caps and pads on negotiation errors. Original commit message from CVS: * gst/gstpad.c: (gst_pad_accept_caps), (gst_pad_alloc_buffer_full), (gst_pad_push): Don't leak buffers, caps and pads on negotiation errors. --- ChangeLog | 6 ++++++ gst/gstpad.c | 11 +++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index c7ef1fa..21ecfc4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-03-17 Wim Taymans + + * gst/gstpad.c: (gst_pad_accept_caps), (gst_pad_alloc_buffer_full), + (gst_pad_push): + Don't leak buffers, caps and pads on negotiation errors. + 2006-03-16 Stefan Kost * docs/faq/cvs.xml: diff --git a/gst/gstpad.c b/gst/gstpad.c index b6bdba3..d9f607f 100644 --- a/gst/gstpad.c +++ b/gst/gstpad.c @@ -2113,8 +2113,11 @@ gst_pad_accept_caps (GstPad * pad, GstCaps * caps) GST_OBJECT_UNLOCK (pad); /* The current caps on a pad are trivially acceptable */ - if (existing && (caps == existing || gst_caps_is_equal (caps, existing))) - goto is_same_caps; + if (existing) { + if (caps == existing || gst_caps_is_equal (caps, existing)) + goto is_same_caps; + gst_caps_unref (existing); + } if (G_LIKELY (acceptfunc)) { /* we can call the function */ @@ -2582,6 +2585,8 @@ fallback: } not_negotiated: { + gst_buffer_unref (*buf); + *buf = NULL; GST_CAT_LOG_OBJECT (GST_CAT_SCHEDULING, pad, "alloc function returned unacceptable buffer"); return GST_FLOW_NOT_NEGOTIATED; @@ -3351,6 +3356,8 @@ not_linked: } not_negotiated: { + gst_buffer_unref (buffer); + gst_object_unref (peer); GST_CAT_DEBUG_OBJECT (GST_CAT_SCHEDULING, pad, "element pushed buffer then refused to accept the caps"); return GST_FLOW_NOT_NEGOTIATED; -- 2.7.4