vlc | branch: master | Matthias Keiser <[email protected]> | Tue Jun 24 
19:31:09 2014 +0200| [476ca18b25ab3f47f981de1f4522b23abbdc9efa] | committer: 
Jean-Baptiste Kempf

access/directory.c: Fix compilation error on OS X and don't leak.

Signed-off-by: Jean-Baptiste Kempf <[email protected]>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=476ca18b25ab3f47f981de1f4522b23abbdc9efa
---

 modules/access/directory.c |   14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/modules/access/directory.c b/modules/access/directory.c
index ef2a6a3..f4c6107 100644
--- a/modules/access/directory.c
+++ b/modules/access/directory.c
@@ -186,10 +186,16 @@ static int directory_open (directory *p_dir, char 
*psz_entry, DIR **handle)
     }
 #else
     char *path;
-    if (asprintf (&path, "%s/%s", current->path, entry) == -1)
-        goto ENTRY_EACCESS;
-    if ((*handle = vlc_opendir (path)) == NULL)
-        goto ENTRY_ENOTDIR;
+    if (asprintf (&path, "%s/%s", p_dir->path, psz_entry) == -1)
+        return ENTRY_EACCESS;
+
+    *handle = vlc_opendir (path);
+
+    free(path);
+
+    if (*handle == NULL) {
+        return ENTRY_ENOTDIR;
+    }
 #endif
 
     return ENTRY_DIR;

_______________________________________________
vlc-commits mailing list
[email protected]
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to