From 5bd4bc8080525328deb4d1013a96d4ede925e028 Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Thu, 2 Feb 2017 21:06:20 +0900 Subject: [PATCH] hls: Fix various leak on hlsdemux and m3u8 * default_variant should be freed, it holds ref. * GstHLSMedia holds GstM3U8 ref. * gst_m3u8_get_next_fragment() increases ref count. https://bugzilla.gnome.org/show_bug.cgi?id=778073 --- ext/hls/gsthlsdemux.c | 2 ++ ext/hls/m3u8.c | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/ext/hls/gsthlsdemux.c b/ext/hls/gsthlsdemux.c index 32df214767..574485b548 100644 --- a/ext/hls/gsthlsdemux.c +++ b/ext/hls/gsthlsdemux.c @@ -1114,6 +1114,8 @@ gst_hls_demux_update_fragment_info (GstAdaptiveDemuxStream * stream) if (discont) stream->discont = TRUE; + gst_m3u8_media_file_unref (file); + return GST_FLOW_OK; } diff --git a/ext/hls/m3u8.c b/ext/hls/m3u8.c index 3bac7bfaaf..edf08ac4f6 100644 --- a/ext/hls/m3u8.c +++ b/ext/hls/m3u8.c @@ -1182,9 +1182,12 @@ gst_hls_media_unref (GstHLSMedia * media) { g_assert (media != NULL && media->ref_count > 0); if (g_atomic_int_dec_and_test (&media->ref_count)) { + if (media->playlist) + gst_m3u8_unref (media->playlist); g_free (media->group_id); g_free (media->name); g_free (media->uri); + g_free (media->lang); g_free (media); } } @@ -1402,6 +1405,8 @@ gst_hls_master_playlist_unref (GstHLSMasterPlaylist * playlist) (GDestroyNotify) gst_hls_variant_stream_unref); g_list_free_full (playlist->iframe_variants, (GDestroyNotify) gst_hls_variant_stream_unref); + if (playlist->default_variant) + gst_hls_variant_stream_unref (playlist->default_variant); g_free (playlist->last_data); g_free (playlist); }