[vlc-commits] ftp: fix item leak and check error

Thomas Guillem git at videolan.org
Mon May 4 17:45:10 CEST 2015


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Mon May  4 17:43:15 2015 +0200| [ec83163133cdfc85901d1826c3b482bde28631ea] | committer: Thomas Guillem

ftp: fix item leak and check error

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

 modules/access/ftp.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/modules/access/ftp.c b/modules/access/ftp.c
index 7d3f19d..8a52231 100644
--- a/modules/access/ftp.c
+++ b/modules/access/ftp.c
@@ -854,9 +854,15 @@ static int DirRead (access_t *p_access, input_item_node_t *p_current_node)
 
             p_item = input_item_NewWithTypeExt( psz_uri, psz_line, 0, NULL,
                                                 0, -1, ITEM_TYPE_UNKNOWN, 1 );
+            free( psz_uri );
+            if( !p_item )
+            {
+                free( psz_line );
+                return VLC_ENOMEM;
+            }
             input_item_CopyOptions( p_current_node->p_item, p_item );
             input_item_node_AppendItem( p_current_node, p_item );
-            free( psz_uri );
+            input_item_Release( p_item );
         }
         free( psz_line );
     }



More information about the vlc-commits mailing list