[vlc-commits] Fix potential use-after-free (cid #1047503)

Rémi Duraffort git at videolan.org
Sat Jul 13 15:31:25 CEST 2013


vlc/vlc-2.1 | branch: master | Rémi Duraffort <ivoire at videolan.org> | Sat Jul 13 08:40:46 2013 +0200| [ea0b4017d4598d9ffa099fea638b9d8f55c33e02] | committer: Jean-Baptiste Kempf

Fix potential use-after-free (cid #1047503)

psz_realhost is an alias to psz_socks when using socks.

(cherry picked from commit f69f8352dc918118641dd6023d77c78a30f86a6a)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 src/network/tcp.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/network/tcp.c b/src/network/tcp.c
index 61159e0..8c294e7 100644
--- a/src/network/tcp.c
+++ b/src/network/tcp.c
@@ -138,14 +138,15 @@ int net_Connect( vlc_object_t *p_this, const char *psz_host, int i_port,
     }, *res;
 
     int val = vlc_getaddrinfo (psz_realhost, i_realport, &hints, &res);
-    free( psz_socks );
 
     if (val)
     {
         msg_Err (p_this, "cannot resolve %s port %d : %s", psz_realhost,
                  i_realport, gai_strerror (val));
+        free( psz_socks );
         return -1;
     }
+    free( psz_socks );
 
     int timeout = var_InheritInteger (p_this, "ipv4-timeout");
     if (timeout < 0)



More information about the vlc-commits mailing list