summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2015-07-08 23:14:13 +0300
committerSebastian Dröge <sebastian@centricular.com>2015-07-08 23:15:14 +0300
commitcd4755635111775ed2df1616e0410664b4869f81 (patch)
tree68c83e3f2501dc20e91d37cd91bbe8891d75ee2e
parentd525d9c39145fed21a4a7c5dd6aae3a58f14372a (diff)
downloadgstreamer-plugins-bad-cd4755635111775ed2df1616e0410664b4869f81.tar.gz
mpdparser: Fix some memory leaks in the MPD parser and unit test
-rw-r--r--ext/dash/gstmpdparser.c12
-rw-r--r--tests/check/elements/dash_mpd.c4
2 files changed, 10 insertions, 6 deletions
diff --git a/ext/dash/gstmpdparser.c b/ext/dash/gstmpdparser.c
index 879ef6bd2..c46240f30 100644
--- a/ext/dash/gstmpdparser.c
+++ b/ext/dash/gstmpdparser.c
@@ -3832,7 +3832,7 @@ gst_mpd_client_get_next_fragment (GstMpdClient * client,
mediaURL =
g_strdup (gst_mpdparser_get_mediaURL (stream,
currentChunk->SegmentURL));
- indexURL = currentChunk->SegmentURL->index;
+ indexURL = g_strdup (currentChunk->SegmentURL->index);
} else if (stream->cur_seg_template != NULL) {
mediaURL =
gst_mpdparser_build_URL_from_template (stream->
@@ -3905,6 +3905,7 @@ gst_mpd_client_get_next_fragment (GstMpdClient * client,
base_url = gst_uri_from_string (stream->baseURL);
frag_url = gst_uri_from_string_with_base (base_url, mediaURL);
+ g_free (mediaURL);
if (stream->queryURL) {
frag_url = gst_uri_make_writable (frag_url);
gst_uri_set_query_string (frag_url, stream->queryURL);
@@ -3918,11 +3919,8 @@ gst_mpd_client_get_next_fragment (GstMpdClient * client,
gst_uri_set_query_string (frag_url, stream->queryURL);
fragment->index_uri = gst_uri_to_string (frag_url);
gst_uri_unref (frag_url);
- }
-
- gst_uri_unref (base_url);
-
- if (indexURL == NULL && (fragment->index_range_start
+ g_free (indexURL);
+ } else if (indexURL == NULL && (fragment->index_range_start
|| fragment->index_range_end != -1)) {
/* index has no specific URL but has a range, we should only use this if
* the media also has a range, otherwise we are serving some data twice
@@ -3936,6 +3934,8 @@ gst_mpd_client_get_next_fragment (GstMpdClient * client,
}
}
+ gst_uri_unref (base_url);
+
GST_DEBUG ("Loading chunk with URL %s", fragment->uri);
return TRUE;
diff --git a/tests/check/elements/dash_mpd.c b/tests/check/elements/dash_mpd.c
index e17d72ac9..d036994a0 100644
--- a/tests/check/elements/dash_mpd.c
+++ b/tests/check/elements/dash_mpd.c
@@ -2914,6 +2914,8 @@ GST_START_TEST (dash_mpdparser_get_audio_languages)
assert_equals_string ((gchar *) g_list_nth_data (languages, 0), "en");
assert_equals_string ((gchar *) g_list_nth_data (languages, 1), "fr");
+ g_list_free (languages);
+
gst_mpd_client_free (mpdclient);
}
@@ -3266,6 +3268,7 @@ GST_START_TEST (dash_mpdparser_headers)
assert_equals_string (uri, "TestSourceUrl");
assert_equals_int64 (range_start, 100);
assert_equals_int64 (range_end, 200);
+ g_free (uri);
/* get segment url and range from segment indexRange */
ret =
@@ -3275,6 +3278,7 @@ GST_START_TEST (dash_mpdparser_headers)
assert_equals_string (uri, "TestSourceUrl");
assert_equals_int64 (range_start, 10);
assert_equals_int64 (range_end, 20);
+ g_free (uri);
gst_mpd_client_free (mpdclient);
}