[vlc-commits] url: check for errors in compose

Rémi Denis-Courmont git at videolan.org
Wed Aug 24 19:05:46 CEST 2016


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Aug 24 20:04:23 2016 +0300| [3f83cde5a67227a01bc3dd154dd8534bb58c4a41] | committer: Rémi Denis-Courmont

url: check for errors in compose

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3f83cde5a67227a01bc3dd154dd8534bb58c4a41
---

 src/text/url.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/text/url.c b/src/text/url.c
index dbe7efb..fa35d69 100644
--- a/src/text/url.c
+++ b/src/text/url.c
@@ -662,11 +662,15 @@ char *vlc_uri_compose(const vlc_url_t *uri)
         fprintf(stream, "?%s", uri->psz_option);
     /* NOTE: fragment not handled currently */
 
-    fclose(stream);
+    if (ferror(stream))
+        goto error;
+    if (fclose(stream))
+        buf = NULL;
     return buf;
 
 error:
-    fclose(stream);
+    if (fclose(stream))
+        buf = NULL;
     free(buf);
     return NULL;
 }



More information about the vlc-commits mailing list