hlsdemux2: Free current_segment on finalize
authorJan Schmidt <jan@centricular.com>
Thu, 23 Jun 2022 09:24:03 +0000 (19:24 +1000)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Wed, 29 Jun 2022 14:33:30 +0000 (14:33 +0000)
Avoid a memory leak by making sure to release the
current segment on exit if non-NULL

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

subprojects/gst-plugins-good/ext/adaptivedemux2/hls/gsthlsdemux.c

index e191298..c309663 100644 (file)
@@ -1684,6 +1684,11 @@ gst_hls_demux_stream_finalize (GObject * object)
     gst_hls_rendition_stream_unref (hls_stream->pending_rendition);
     hls_stream->pending_rendition = NULL;
   }
+
+  if (hls_stream->current_segment) {
+    gst_m3u8_media_segment_unref (hls_stream->current_segment);
+    hls_stream->current_segment = NULL;
+  }
   gst_hls_demux_stream_decrypt_end (hls_stream);
 
   G_OBJECT_CLASS (stream_parent_class)->finalize (object);