Changeset 48a985ecd756e3969c4b55998f24e281f03c1536

Show
Ignore:
Timestamp:
05/10/08 19:46:18 (6 days ago)
Author:
Rémi Denis-Courmont <rem@videolan.org>
git-committer:
Rémi Denis-Courmont <rem@videolan.org> 1210441578 +0300
git-parent:

[492c2c6822d71bf82076188cd21898b3ee2c9981]

git-author:
Rémi Denis-Courmont <rem@videolan.org> 1210441571 +0300
Message:

Don't look for plugins from CWD. Also don't leak in case of errors.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/modules/modules.c

    r1eea47c r48a985e  
    904904static void AllocateAllPlugins( vlc_object_t *p_this ) 
    905905{ 
     906    const char *vlcpath = vlc_global()->psz_vlcpath; 
    906907    int count,i; 
    907908    char * path; 
     
    910911    /* Contruct the special search path for system that have a relocatable 
    911912     * executable. Set it to <vlc path>/modules and <vlc path>/plugins. */ 
    912 #define RETURN_ENOMEM                               \ 
    913     {                                               \ 
    914         msg_Err( p_this, "Not enough memory" );     \ 
    915         return;                                     \ 
    916     } 
    917  
    918     vlc_array_append( arraypaths, strdup( "modules" ) ); 
    919 #if defined( WIN32 ) || defined( UNDER_CE ) || defined( __APPLE__ ) || defined( SYS_BEOS ) 
    920     if( asprintf( &path, "%s" DIR_SEP "modules", 
    921         vlc_global()->psz_vlcpath ) < 0 ) 
    922         RETURN_ENOMEM 
    923     vlc_array_append( arraypaths, path ); 
    924     if( asprintf( &path, "%s" DIR_SEP "plugins", 
    925         vlc_global()->psz_vlcpath ) < 0 ) 
    926         RETURN_ENOMEM 
    927     vlc_array_append( arraypaths, path ); 
    928 #if ! defined( WIN32 ) && ! defined( UNDER_CE ) 
    929     if( asprintf( &path, "%s", PLUGIN_PATH ) < 0 ) 
    930         RETURN_ENOMEM 
    931     vlc_array_append( arraypaths, path ); 
    932 #endif 
    933 #else 
     913 
     914    if( vlcpath && asprintf( &path, "%s" DIR_SEP "modules", vlcpath ) != -1 ) 
     915        vlc_array_append( arraypaths, path ); 
     916    if( vlcpath && asprintf( &path, "%s" DIR_SEP "plugins", vlcpath ) != -1 ) 
     917        vlc_array_append( arraypaths, path ); 
     918#ifndef WIN32 
    934919    vlc_array_append( arraypaths, strdup( PLUGIN_PATH ) ); 
    935920#endif 
    936     vlc_array_append( arraypaths, strdup( "plugins" ) ); 
    937921 
    938922    /* If the user provided a plugin path, we add it to the list */ 
     
    943927    { 
    944928        path = copy_next_paths_token( paths_iter, &paths_iter ); 
    945         if( !path ) 
    946             RETURN_ENOMEM 
    947         vlc_array_append( arraypaths, strdup( path ) ); 
     929        if( path ) 
     930            vlc_array_append( arraypaths, strdup( path ) ); 
    948931    } 
    949932 
     
    953936        path = vlc_array_item_at_index( arraypaths, i ); 
    954937        if( !path ) 
    955         { 
    956938            continue; 
    957         } 
    958939 
    959940        msg_Dbg( p_this, "recursively browsing `%s'", path ); 
     
    966947 
    967948    vlc_array_destroy( arraypaths ); 
    968 #undef RETURN_ENOMEM 
    969949} 
    970950