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

Rémi Duraffort git at videolan.org
Sat Jul 13 08:43:16 CEST 2013


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Sat Jul 13 08:40:46 2013 +0200| [f69f8352dc918118641dd6023d77c78a30f86a6a] | committer: Rémi Duraffort

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

psz_realhost is an alias to psz_socks when using socks.

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

 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