mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
hlsdemux2: m3u8: Fix memory leaks on parsing
Fix memory leaks when parsing of an m3u8 file is incomplete, with EXTINF or EXT-X-PROGRAM-DATE-TIME directives, but no segment url. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2873>
This commit is contained in:
parent
0ff317f107
commit
a6eb725413
1 changed files with 7 additions and 2 deletions
|
@ -509,6 +509,7 @@ gst_hls_media_playlist_parse (gchar * data, const gchar * uri,
|
||||||
data = NULL;
|
data = NULL;
|
||||||
date_time = NULL;
|
date_time = NULL;
|
||||||
duration = 0;
|
duration = 0;
|
||||||
|
g_free (title);
|
||||||
title = NULL;
|
title = NULL;
|
||||||
discontinuity = FALSE;
|
discontinuity = FALSE;
|
||||||
size = offset = -1;
|
size = offset = -1;
|
||||||
|
@ -552,9 +553,9 @@ gst_hls_media_playlist_parse (gchar * data, const gchar * uri,
|
||||||
if (last_init_file)
|
if (last_init_file)
|
||||||
file->init_file = gst_m3u8_init_file_ref (last_init_file);
|
file->init_file = gst_m3u8_init_file_ref (last_init_file);
|
||||||
|
|
||||||
date_time = NULL;
|
date_time = NULL; /* Ownership was passed to the segment */
|
||||||
duration = 0;
|
duration = 0;
|
||||||
title = NULL;
|
title = NULL; /* Ownership was passed to the segment */
|
||||||
discontinuity = FALSE;
|
discontinuity = FALSE;
|
||||||
size = offset = -1;
|
size = offset = -1;
|
||||||
g_ptr_array_add (self->segments, file);
|
g_ptr_array_add (self->segments, file);
|
||||||
|
@ -737,8 +738,12 @@ gst_hls_media_playlist_parse (gchar * data, const gchar * uri,
|
||||||
data = g_utf8_next_char (end); /* skip \n */
|
data = g_utf8_next_char (end); /* skip \n */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Clean up date that wasn't freed / handed to a segment */
|
||||||
g_free (current_key);
|
g_free (current_key);
|
||||||
current_key = NULL;
|
current_key = NULL;
|
||||||
|
if (date_time)
|
||||||
|
g_date_time_unref (date_time);
|
||||||
|
g_free (title);
|
||||||
|
|
||||||
g_free (input_data);
|
g_free (input_data);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue