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