]> git.sesse.net Git - vlc/blobdiff - src/control/media_library.c
vcdx: Fix memleaks.
[vlc] / src / control / media_library.c
index da9cd48049dd7b2e96724635a962ef9e00341165..a85c1b92e333063f1c5d48f61124cb75732b8249 100644 (file)
@@ -1,6 +1,6 @@
 /*****************************************************************************
  * tree.c: libvlc tags tree functions
- * Create a tree of the 'tags' of a media_list's media_descriptors.
+ * Create a tree of the 'tags' of a media_list's medias.
  *****************************************************************************
  * Copyright (C) 2007 the VideoLAN team
  * $Id$
@@ -23,6 +23,7 @@
  *****************************************************************************/
 #include "libvlc_internal.h"
 #include <vlc/libvlc.h>
+#include "libvlc.h"
 #include "vlc_arrays.h"
 
 /*
@@ -88,7 +89,7 @@ void
 libvlc_media_library_load( libvlc_media_library_t * p_mlib,
                            libvlc_exception_t * p_e )
 {
-    const char *psz_datadir = p_mlib->p_libvlc_instance->p_libvlc_int->psz_datadir;
+    char *psz_datadir = config_GetUserDataDir();
     char * psz_uri;
 
     if( !psz_datadir ) /* XXX: i doubt that this can ever happen */
@@ -100,9 +101,11 @@ libvlc_media_library_load( libvlc_media_library_t * p_mlib,
     if( asprintf( &psz_uri, "file/xspf-open://%s" DIR_SEP "ml.xsp",
                   psz_datadir ) == -1 )
     {
+        free( psz_datadir );
         libvlc_exception_raise( p_e, "Can't get create the path" );
         return;
     }
+    free( psz_datadir );
     if( p_mlib->p_mlist )
         libvlc_media_list_release( p_mlib->p_mlist );