From da9a3da8aaff32442a51a97629c760f4dd1f4e28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Sun, 2 May 2021 20:45:01 +0300 Subject: [PATCH] appsrc: Don't leak buffer list while wrongly unreffing buffer on EOS/flushing Part-of: --- gst-libs/gst/app/gstappsrc.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/gst-libs/gst/app/gstappsrc.c b/gst-libs/gst/app/gstappsrc.c index a6f531d382..c2267a045a 100644 --- a/gst-libs/gst/app/gstappsrc.c +++ b/gst-libs/gst/app/gstappsrc.c @@ -2003,16 +2003,24 @@ gst_app_src_push_internal (GstAppSrc * appsrc, GstBuffer * buffer, flushing: { GST_DEBUG_OBJECT (appsrc, "refuse buffer %p, we are flushing", buffer); - if (steal_ref) - gst_buffer_unref (buffer); + if (steal_ref) { + if (buflist) + gst_buffer_list_unref (buflist); + else + gst_buffer_unref (buffer); + } g_mutex_unlock (&priv->mutex); return GST_FLOW_FLUSHING; } eos: { GST_DEBUG_OBJECT (appsrc, "refuse buffer %p, we are EOS", buffer); - if (steal_ref) - gst_buffer_unref (buffer); + if (steal_ref) { + if (buflist) + gst_buffer_list_unref (buflist); + else + gst_buffer_unref (buffer); + } g_mutex_unlock (&priv->mutex); return GST_FLOW_EOS; }