From 0a8b8ceda0ee88e6c2b85563a7c1315e4e12b0a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Fri, 16 Apr 2010 20:03:21 +0200 Subject: [PATCH] audiorate: Don't leak the input buffer in error cases Fixes bug #615572. --- gst/audiorate/gstaudiorate.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gst/audiorate/gstaudiorate.c b/gst/audiorate/gstaudiorate.c index c826bdebe6..f5f1d49739 100644 --- a/gst/audiorate/gstaudiorate.c +++ b/gst/audiorate/gstaudiorate.c @@ -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;