From b3a18a2fcc9f9d88cc1b70b8f351fc5b106c31d5 Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Wed, 9 Apr 2014 18:44:38 +0100 Subject: [PATCH] hlssink: catch failure to write playlist file Coverity 1139613 --- ext/hls/gsthlssink.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ext/hls/gsthlssink.c b/ext/hls/gsthlssink.c index 7180755689..8a3c305c82 100644 --- a/ext/hls/gsthlssink.c +++ b/ext/hls/gsthlssink.c @@ -283,8 +283,14 @@ gst_hls_sink_handle_message (GstBin * bin, GstMessage * message) title, duration, sink->index, discont); g_free (entry_location); playlist_content = gst_m3u8_playlist_render (sink->playlist); - g_file_set_contents (sink->playlist_location, - playlist_content, -1, &error); + if (!g_file_set_contents (sink->playlist_location, + playlist_content, -1, &error)) { + GST_ERROR ("Failed to write playlist: %s", error->message); + GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE, + (("Failed to write playlist '%s'."), error->message), (NULL)); + g_error_free (error); + error = NULL; + } g_free (playlist_content); /* multifilesink is starting a new file. It means that upstream sent a key