]> git.sesse.net Git - vlc/blobdiff - modules/access/directory.c
Fix the worst memory leaks. I hope.
[vlc] / modules / access / directory.c
index f2b8aec07913e54c84e2e9ad9c31e0273c07d651..b778cf0e252ff37cac3c064a0a556c3092462a77 100644 (file)
@@ -46,9 +46,6 @@
 #   include <io.h>
 #endif
 
-#ifdef HAVE_DIRENT_H
-#   include <dirent.h>
-#endif
 #ifdef __sun__
 static inline int dirfd (DIR *dir)
 {
@@ -99,10 +96,10 @@ int DirOpen( vlc_object_t *p_this )
 {
     access_t *p_access = (access_t*)p_this;
 
-    if( !p_access->psz_path )
+    if( !p_access->psz_filepath )
         return VLC_EGENERIC;
 
-    DIR *handle = vlc_opendir (p_access->psz_path);
+    DIR *handle = vlc_opendir (p_access->psz_filepath);
     if (handle == NULL)
         return VLC_EGENERIC;
 
@@ -118,11 +115,11 @@ int DirInit (access_t *p_access, DIR *handle)
     char *uri;
     if (!strcmp (p_access->psz_access, "fd"))
     {
-        if (asprintf (&uri, "fd://%s", p_access->psz_path) == -1)
+        if (asprintf (&uri, "fd://%s", p_access->psz_location) == -1)
             uri = NULL;
     }
     else
-        uri = make_URI (p_access->psz_path);
+        uri = make_URI (p_access->psz_filepath, "file");
     if (unlikely(uri == NULL))
         goto error;
 
@@ -238,7 +235,7 @@ block_t *DirBlock (access_t *p_access)
         current->parent = NULL;
         current->handle = p_sys->handle;
 #ifndef HAVE_OPENAT
-        current->path = strdup (p_access->psz_path);
+        current->path = strdup (p_access->psz_filepath);
 #endif
         current->uri = p_sys->uri;
         if (fstat (dirfd (current->handle), &current->st))