From ab459f0528d8eba17589c8a8582b69a166616384 Mon Sep 17 00:00:00 2001 From: Jan Schmidt Date: Tue, 12 Jul 2022 21:19:35 +1000 Subject: [PATCH] splitmuxsink: Fix memory leak Fix a leak of the buffer info struct when reaching EOS without data on the reference input. Part-of: --- .../gst-plugins-good/gst/multifile/gstsplitmuxsink.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/subprojects/gst-plugins-good/gst/multifile/gstsplitmuxsink.c b/subprojects/gst-plugins-good/gst/multifile/gstsplitmuxsink.c index 948ca35ba7..5e4ae02e31 100644 --- a/subprojects/gst-plugins-good/gst/multifile/gstsplitmuxsink.c +++ b/subprojects/gst-plugins-good/gst/multifile/gstsplitmuxsink.c @@ -3202,9 +3202,7 @@ handle_mq_input (GstPad * pad, GstPadProbeInfo * info, MqStreamCtx * ctx) if (g_queue_is_empty (&splitmux->pending_input_gops)) { GST_WARNING_OBJECT (pad, "Reference was closed without GOP, dropping"); - GST_SPLITMUX_UNLOCK (splitmux); - GST_PAD_PROBE_INFO_FLOW_RETURN (info) = GST_FLOW_EOS; - return GST_PAD_PROBE_DROP; + goto drop; } check_completed_gop (splitmux, ctx); @@ -3255,6 +3253,12 @@ beach: mq_stream_buf_free (buf_info); GST_PAD_PROBE_INFO_FLOW_RETURN (info) = ret; return GST_PAD_PROBE_PASS; +drop: + GST_SPLITMUX_UNLOCK (splitmux); + if (buf_info) + mq_stream_buf_free (buf_info); + GST_PAD_PROBE_INFO_FLOW_RETURN (info) = GST_FLOW_EOS; + return GST_PAD_PROBE_DROP; } static void