[vlc-devel] [PATCH] access/directory.c: Fix compilation error on OS X and don't leak.
Matthias Keiser
matthias at tristan-inc.com
Tue Jun 24 19:31:09 CEST 2014
---
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;
--
1.8.5.2 (Apple Git-48)
More information about the vlc-devel
mailing list