]> git.sesse.net Git - vlc/commitdiff
fixed a few problems with stream_UrlNew
authorSigmund Augdal Helberg <sigmunau@videolan.org>
Fri, 1 Apr 2005 22:23:22 +0000 (22:23 +0000)
committerSigmund Augdal Helberg <sigmunau@videolan.org>
Fri, 1 Apr 2005 22:23:22 +0000 (22:23 +0000)
include/vlc_stream.h
src/input/stream.c

index e81a1cd4626bbdf16cd318bb300a443000d8a137..84e78034b84192de8abf1fb203080fc4a7440208 100644 (file)
@@ -199,7 +199,7 @@ VLC_EXPORT( void,      stream_DemuxDelete,( stream_t *s ) );
 #define stream_MemoryNew( a, b, c, d ) __stream_MemoryNew( VLC_OBJECT(a), b, c, d )
 VLC_EXPORT( stream_t *,__stream_MemoryNew, (vlc_object_t *p_obj, uint8_t *p_buffer, int64_t i_size, vlc_bool_t i_preserve_memory ) );
 #define stream_UrlNew( a, b ) __stream_UrlNew( VLC_OBJECT(a), b )
-VLC_EXPORT( stream_t *,__stream_UrlNew, (vlc_object_t *p_this, char *psz_url ) );
+VLC_EXPORT( stream_t *,__stream_UrlNew, (vlc_object_t *p_this, const char *psz_url ) );
 
 /**
  * @}
index 7e681770d5d0229d39520a8bec075de6e2b4f940..6adb86375ec77a4c9c1ccf4dc83ee262222cc19e 100644 (file)
@@ -188,33 +188,38 @@ static int  ASeek( stream_t *s, int64_t i_pos );
 /****************************************************************************
  * stream_AccessNew: create a stream from a access
  ****************************************************************************/
-stream_t *__stream_UrlNew( vlc_object_t *p_parent, char *psz_url )
+stream_t *__stream_UrlNew( vlc_object_t *p_parent, const char *psz_url )
 {
-    char *psz_access, *psz_demux, *psz_path;
+    char *psz_access, *psz_demux, *psz_path, *psz_dup;
     access_t *p_access;
     stream_t *p_res;
-    
-    MRLSplit( p_parent, psz_url, &psz_access, &psz_demux, &psz_path );
+
+    psz_dup = strdup( psz_url );
+    MRLSplit( p_parent, psz_dup, &psz_access, &psz_demux, &psz_path );
     
     /* Now try a real access */
     p_access = access2_New( p_parent, psz_access, NULL,
-                            psz_path, VLC_TRUE );
+                            psz_path, VLC_FALSE );
 
     if( p_access == NULL )
     {
         msg_Err( p_parent, "no suitable access module for `%s'", psz_url );
+        free( psz_dup );
         return NULL;
     }
     p_res = stream_AccessNew( p_access, VLC_TRUE );
     if( p_res )
     {
         p_res->pf_destroy = UStreamDestroy;
+        free( psz_dup );
         return p_res;
     }
     else
     {
         access2_Delete( p_access );
     }
+    free( psz_dup );
+    return NULL;
 }
 
 stream_t *stream_AccessNew( access_t *p_access, vlc_bool_t b_quick )