[vlc-commits] udp: memory leak

Rémi Denis-Courmont git at videolan.org
Fri Nov 14 18:24:21 CET 2014


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Nov 14 19:24:05 2014 +0200| [00b9dd8cbcd4ccd466a28d4f3fa2b7b605ca6276] | committer: Rémi Denis-Courmont

udp: memory leak

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

 modules/access/udp.c |   14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/modules/access/udp.c b/modules/access/udp.c
index 5a4168f..76f68a2 100644
--- a/modules/access/udp.c
+++ b/modules/access/udp.c
@@ -90,12 +90,6 @@ static void* ThreadRead( void *data );
 static int Open( vlc_object_t *p_this )
 {
     access_t     *p_access = (access_t*)p_this;
-
-    char *psz_name = strdup( p_access->psz_location );
-    char *psz_parser;
-    const char *psz_server_addr, *psz_bind_addr = "";
-    int  i_bind_port = 1234, i_server_port = 0;
-
     access_sys_t *sys = malloc( sizeof( *sys ) );
     if( unlikely( sys == NULL ) )
         return VLC_ENOMEM;
@@ -106,6 +100,14 @@ static int Open( vlc_object_t *p_this )
     access_InitFields( p_access );
     ACCESS_SET_CALLBACKS( NULL, BlockUDP, Control, NULL );
 
+    char *psz_name = strdup( p_access->psz_location );
+    char *psz_parser;
+    const char *psz_server_addr, *psz_bind_addr = "";
+    int  i_bind_port = 1234, i_server_port = 0;
+
+    if( unlikely(psz_name == NULL) )
+        goto error;
+
     /* Parse psz_name syntax :
      * [serveraddr[:serverport]][@[bindaddr]:[bindport]] */
     psz_parser = strchr( psz_name, '@' );



More information about the vlc-commits mailing list