[vlc-commits] access/directory.c: Fix compilation error on OS X and don't leak.

Matthias Keiser git at videolan.org
Tue Jun 24 20:05:20 CEST 2014


vlc | branch: master | Matthias Keiser <matthias at tristan-inc.com> | 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 <jb at videolan.org>

> 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;



More information about the vlc-commits mailing list