audiorate: Don't leak the input buffer in error cases

Fixes bug #615572.
This commit is contained in:
Sebastian Dröge 2010-04-16 20:03:21 +02:00
parent efe59faa93
commit 0a8b8ceda0

View file

@ -637,6 +637,7 @@ gst_audio_rate_chain (GstPad * pad, GstBuffer * buf)
/* we can drop the buffer completely */
gst_buffer_unref (buf);
buf = NULL;
if (!audiorate->silent)
g_object_notify (G_OBJECT (audiorate), "drop");
@ -701,11 +702,15 @@ send:
GST_BUFFER_TIMESTAMP (buf) + GST_BUFFER_DURATION (buf));
ret = gst_pad_push (audiorate->srcpad, buf);
buf = NULL;
audiorate->out++;
audiorate->next_offset = in_offset_end;
beach:
if (buf)
gst_buffer_unref (buf);
gst_object_unref (audiorate);
return ret;
@ -713,6 +718,8 @@ beach:
/* ERRORS */
not_negotiated:
{
gst_buffer_unref (buf);
GST_ELEMENT_ERROR (audiorate, STREAM, FORMAT,
(NULL), ("pipeline error, format was not negotiated"));
return GST_FLOW_NOT_NEGOTIATED;