]> git.sesse.net Git - vlc/blobdiff - modules/access/bd/bd.c
Don't leak references to card when we have more than one.
[vlc] / modules / access / bd / bd.c
index b1fdb53b91af4908e6ec5720dd4f67a754ac0aab..cdb169f4835eed79dd91d21a3bdc75f4a29c0e83 100644 (file)
@@ -65,8 +65,7 @@ vlc_module_begin ()
     add_integer( "bd-caching", DEFAULT_PTS_DELAY / 1000, NULL,
         CACHING_TEXT, CACHING_LONGTEXT, true )
     set_capability( "access_demux", 60 )
-    add_shortcut( "bd" )
-    add_shortcut( "file" )
+    add_shortcut( "bd", "file" )
     set_callbacks( Open, Close )
 vlc_module_end ()
 
@@ -153,6 +152,8 @@ static int Open( vlc_object_t *p_this )
     demux_t     *p_demux = (demux_t*)p_this;
     demux_sys_t *p_sys;
 
+    if( p_demux->psz_file == NULL )
+        return VLC_EGENERIC;
     if( *p_demux->psz_access &&
         strcmp( p_demux->psz_access, "bd" ) &&
         strcmp( p_demux->psz_access, "file" ) )
@@ -160,7 +161,7 @@ static int Open( vlc_object_t *p_this )
 
     /* */
     bool b_shortname;
-    char *psz_base = FindPathBase( p_demux->psz_path, &b_shortname );
+    char *psz_base = FindPathBase( p_demux->psz_file, &b_shortname );
     if( !psz_base )
         return VLC_EGENERIC;
 
@@ -944,7 +945,7 @@ static int CheckFileList( const char *psz_base, const char *ppsz_name[] )
         if( asprintf( &psz_tmp, "%s/%s", psz_base, ppsz_name[i] ) < 0 )
             return VLC_EGENERIC;
 
-        bool b_ok = utf8_stat( psz_tmp, &s ) == 0 && S_ISREG( s.st_mode );
+        bool b_ok = vlc_stat( psz_tmp, &s ) == 0 && S_ISREG( s.st_mode );
 
         free( psz_tmp );
         if( !b_ok )
@@ -968,13 +969,13 @@ static char *FindPathBase( const char *psz_path, bool *pb_shortname )
         psz_base[strlen(psz_base)-1] = '\0';
 
     /* */
-    if( utf8_stat( psz_base, &s ) || !S_ISDIR( s.st_mode ) )
+    if( vlc_stat( psz_base, &s ) || !S_ISDIR( s.st_mode ) )
         goto error;
 
     /* Check BDMV */
     if( asprintf( &psz_tmp, "%s/BDMV", psz_base ) < 0 )
         goto error;
-    if( !utf8_stat( psz_tmp, &s ) && S_ISDIR( s.st_mode ) )
+    if( !vlc_stat( psz_tmp, &s ) && S_ISDIR( s.st_mode ) )
     {
         free( psz_base );
         psz_base = psz_tmp;
@@ -1212,7 +1213,7 @@ static int Load( demux_t *p_demux,
 
     char **ppsz_list;
 
-    int i_list = utf8_scandir( psz_playlist, &ppsz_list, pf_filter, ScanSort );
+    int i_list = vlc_scandir( psz_playlist, &ppsz_list, pf_filter, ScanSort );
 
     for( int i = 0; i < i_list; i++ )
     {