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.
This commit is contained in:
Wim Taymans 2006-03-17 19:27:51 +00:00
parent 0dbc4f8321
commit c815b879fe
2 changed files with 15 additions and 2 deletions

View file

@ -1,3 +1,9 @@
2006-03-17 Wim Taymans <wim@fluendo.com>
* 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 <ensonic@users.sf.net>
* docs/faq/cvs.xml:

View file

@ -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;