[vlc-commits] smb: Fix memory leak

Hugo Beauzée-Luyssen git at videolan.org
Mon May 15 13:13:29 CEST 2017


vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Mon May 15 10:16:50 2017 +0200| [2db30aeed67095071a47dae234dd7f83e25e33b7] | committer: Hugo Beauzée-Luyssen

smb: Fix memory leak

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

 modules/access/smb.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/modules/access/smb.c b/modules/access/smb.c
index 872e4def2c..57e058926a 100644
--- a/modules/access/smb.c
+++ b/modules/access/smb.c
@@ -246,6 +246,8 @@ static int Open( vlc_object_t *p_this )
         p_access->pf_control = access_vaDirectoryControlHelper;
         i_smb = smbc_opendir( psz_uri );
         i_size = 0;
+        if( i_smb < 0 )
+            vlc_UrlClean( &p_sys->url );
 #endif
     }
     else
@@ -253,6 +255,7 @@ static int Open( vlc_object_t *p_this )
         ACCESS_SET_CALLBACKS( Read, NULL, Control, Seek );
         i_smb = smbc_open( psz_uri, O_RDONLY, 0 );
         i_size = filestat.st_size;
+        vlc_UrlClean( &url );
     }
     free( psz_uri );
 
@@ -260,7 +263,6 @@ static int Open( vlc_object_t *p_this )
     {
         msg_Err( p_access, "open failed for '%s' (%s)",
                  p_access->psz_location, vlc_strerror_c(errno) );
-        vlc_UrlClean( &p_sys->url );
         free( p_sys );
         return VLC_EGENERIC;
     }



More information about the vlc-commits mailing list