[vlc-devel] [PATCH] access/directory.c: Fix a case where a double closedir could occur

Julien 'Lta' BALLET elthariel at gmail.com
Mon Jul 7 17:50:51 CEST 2014


From: Julien 'Lta' BALLET <contact at lta.io>

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

diff --git a/modules/access/directory.c b/modules/access/directory.c
index c10cd96..717bc7d 100644
--- a/modules/access/directory.c
+++ b/modules/access/directory.c
@@ -237,7 +237,6 @@ static bool directory_push (access_sys_t *p_sys, DIR *handle, char *psz_uri)
     return true;
 
     error:
-    closedir (handle);
     free (p_dir);
     free (psz_uri);
 
@@ -420,10 +419,12 @@ int DirRead (access_t *p_access, input_item_node_t *p_current_node)
         /* Handle directory flags and recursion if in EXPAND mode  */
         if (i_res == ENTRY_DIR)
         {
-            if (p_sys->mode == MODE_EXPAND
-                && directory_push (p_sys, handle, psz_full_uri))
+            if (p_sys->mode == MODE_EXPAND)
             {
+                if (directory_push (p_sys, handle, psz_full_uri))
                     p_current_node = p_new_node;
+                else
+                    closedir (handle);
             }
         }
 
-- 
2.0.0




More information about the vlc-devel mailing list