[vlc-devel] commit: vlc_inet_pton: fix memory leak ( Rémi Denis-Courmont )

git version control git at videolan.org
Wed Aug 13 18:07:07 CEST 2008


vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Wed Aug 13 19:09:48 2008 +0300| [c345ce53f9ab07d1a21b68cf02fa4f95ed32129b] | committer: Rémi Denis-Courmont 

vlc_inet_pton: fix memory leak

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

 src/network/getaddrinfo.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/network/getaddrinfo.c b/src/network/getaddrinfo.c
index 23a0d25..49e7025 100644
--- a/src/network/getaddrinfo.c
+++ b/src/network/getaddrinfo.c
@@ -518,8 +518,8 @@ static WSAAPI int _ws2_getaddrinfo_bind(const char FAR *node, const char FAR *se
     if ((entry == NULL) ||  (freentry == NULL))
     {
         /* not found, use replacement API instead */
-    entry = getaddrinfo;
-    freentry = freeaddrinfo;
+        entry = getaddrinfo;
+        freentry = freeaddrinfo;
     }
     /* call API before replacing function pointer to avoid crash */
     result = entry (node, service, hints, res);
@@ -723,9 +723,11 @@ int vlc_inet_pton (int af, const char *src, void *dst)
             break;
 #endif
         default:
+            freeaddrinfo (res);
             return -1;
     }
     memcpy (dst, data, len);
+    freeaddrinfo (res);
     return 1;
 #else /* HAVE_INET_PTON */
     return inet_pton( af, src, dst );




More information about the vlc-devel mailing list