]> git.sesse.net Git - vlc/blobdiff - src/config/file.c
Fix memleak in audio equalizer.
[vlc] / src / config / file.c
index b6ce5eff06286289bb9d4baaaa9ed52daa1dac50..894ebbb14e081062cd69a7f446e5881b0612b9a4 100644 (file)
@@ -25,7 +25,7 @@
 # include "config.h"
 #endif
 
-#include <vlc/vlc.h>
+#include <vlc_common.h>
 #include "../libvlc.h"
 #include "vlc_charset.h"
 #include "vlc_keys.h"
 #include <errno.h>                                                  /* errno */
 #include <assert.h>
 #include <limits.h>
+#ifdef __APPLE__
+#   include <xlocale.h>
+#else
 #include <locale.h>
+#endif
 
 #include "configuration.h"
 #include "modules/modules.h"
@@ -85,7 +89,7 @@ static FILE *config_OpenConfigFile( vlc_object_t *p_obj, const char *mode )
          * Specification configs */
         char *psz_old;
         if( asprintf( &psz_old, "%s" DIR_SEP CONFIG_DIR DIR_SEP CONFIG_FILE,
-                  p_obj->p_libvlc->psz_homedir ) != -1 )
+                      config_GetHomeDir() ) != -1 )
         {
             p_stream = utf8_fopen( psz_old, mode );
             if( p_stream )
@@ -96,7 +100,7 @@ static FILE *config_OpenConfigFile( vlc_object_t *p_obj, const char *mode )
                           "VLC will now use %s.", psz_old, psz_filename );
                 char *psz_readme;
                 if( asprintf(&psz_readme,"%s"DIR_SEP CONFIG_DIR DIR_SEP"README",
-                              p_obj->p_libvlc->psz_homedir ) != -1 )
+                              config_GetHomeDir() ) != -1 )
                 {
                     FILE *p_readme = utf8_fopen( psz_readme, "wt" );
                     if( p_readme )
@@ -329,7 +333,7 @@ int __config_LoadConfigFile( vlc_object_t *p_this, const char *psz_module_name )
  *****************************************************************************/
 int config_CreateDir( vlc_object_t *p_this, const char *psz_dirname )
 {
-    if( !psz_dirname && !*psz_dirname ) return -1;
+    if( !psz_dirname || !*psz_dirname ) return -1;
 
     if( utf8_mkdir( psz_dirname, 0700 ) == 0 )
         return 0;
@@ -710,7 +714,7 @@ char *config_GetCustomConfigFile( libvlc_int_t *p_libvlc )
         {
             /* This is incomplete: we should also support the ~cmassiot/ syntax */
             char *psz_buf;
-            if( asprintf( &psz_buf, "%s/%s", p_libvlc->psz_homedir,
+            if( asprintf( &psz_buf, "%s/%s", config_GetHomeDir(),
                           psz_configfile + 2 ) == -1 )
             {
                 free( psz_configfile );