hlsdemux: fix potential error leak

Clear error as soon as we determine that the download failed,
otherwise there are code paths where we might return without
clearing it ever, which would leak the GError then. Also, we
can pass a NULL GError pointer to _fetch_uri(), so just do that
instead of passing one that we're going to just free again
right away anyway.
This commit is contained in:
Tim-Philipp Müller 2015-12-19 20:59:12 +00:00
parent d59413ba06
commit 8be5551dff

View file

@ -827,18 +827,17 @@ retry:
TRUE, TRUE, TRUE, err); TRUE, TRUE, TRUE, err);
g_free (main_uri); g_free (main_uri);
if (download == NULL) { if (download == NULL) {
g_clear_error (err);
if (update && !main_checked if (update && !main_checked
&& gst_m3u8_client_has_variant_playlist (demux->client)) { && gst_m3u8_client_has_variant_playlist (demux->client)) {
GError *err2 = NULL;
main_uri = gst_m3u8_client_get_uri (demux->client); main_uri = gst_m3u8_client_get_uri (demux->client);
GST_INFO_OBJECT (demux, GST_INFO_OBJECT (demux,
"Updating playlist %s failed, attempt to refresh variant playlist %s", "Updating playlist %s failed, attempt to refresh variant playlist %s",
uri, main_uri); uri, main_uri);
download = download =
gst_uri_downloader_fetch_uri (adaptive_demux->downloader, gst_uri_downloader_fetch_uri (adaptive_demux->downloader,
main_uri, NULL, TRUE, TRUE, TRUE, &err2); main_uri, NULL, TRUE, TRUE, TRUE, NULL);
g_free (main_uri); g_free (main_uri);
g_clear_error (&err2);
if (download != NULL) { if (download != NULL) {
gchar *base_uri; gchar *base_uri;
@ -872,7 +871,6 @@ retry:
g_object_unref (download); g_object_unref (download);
g_clear_error (err);
main_checked = TRUE; main_checked = TRUE;
goto retry; goto retry;
} else { } else {