[vlc-commits] httpd: do not fail-open on memory errors

Rémi Denis-Courmont git at videolan.org
Sun Apr 27 16:02:34 CEST 2014


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Apr 27 17:02:15 2014 +0300| [dc44a90cbb08b6018a9a911ec8b41718a06291a5] | committer: Rémi Denis-Courmont

httpd: do not fail-open on memory errors

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

 src/network/httpd.c |   13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/network/httpd.c b/src/network/httpd.c
index 6fd0235..b8fb979 100644
--- a/src/network/httpd.c
+++ b/src/network/httpd.c
@@ -759,10 +759,9 @@ httpd_stream_t *httpd_StreamNew(httpd_host_t *host,
     }
 
     vlc_mutex_init(&stream->lock);
-    if (psz_mime && *psz_mime)
-        stream->psz_mime = strdup(psz_mime);
-    else
-        stream->psz_mime = strdup(vlc_mime_Ext2Mime(psz_url));
+    if (psz_mime == NULL || psz_mime[0] == '\0')
+        psz_mime = vlc_mime_Ext2Mime(psz_url);
+    stream->psz_mime = xstrdup(psz_mime);
 
     stream->i_header = 0;
     stream->p_header = NULL;
@@ -1100,9 +1099,9 @@ httpd_url_t *httpd_UrlNew(httpd_host_t *host, const char *psz_url,
     url->host = host;
 
     vlc_mutex_init(&url->lock);
-    url->psz_url = strdup(psz_url);
-    url->psz_user = strdup(psz_user ? psz_user : "");
-    url->psz_password = strdup(psz_password ? psz_password : "");
+    url->psz_url = xstrdup(psz_url);
+    url->psz_user = xstrdup(psz_user ? psz_user : "");
+    url->psz_password = xstrdup(psz_password ? psz_password : "");
     for (int i = 0; i < HTTPD_MSG_MAX; i++) {
         url->catch[i].cb = NULL;
         url->catch[i].p_sys = NULL;



More information about the vlc-commits mailing list