splitmuxsink: Fix memory leak
authorJan Schmidt <jan@centricular.com>
Tue, 12 Jul 2022 11:19:35 +0000 (21:19 +1000)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Tue, 12 Jul 2022 11:22:33 +0000 (11:22 +0000)
Fix a leak of the buffer info struct when reaching
EOS without data on the reference input.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2751>

subprojects/gst-plugins-good/gst/multifile/gstsplitmuxsink.c

index 948ca35..5e4ae02 100644 (file)
@@ -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