Commit c345ce53 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

vlc_inet_pton: fix memory leak

parent 119a49ff
...@@ -518,8 +518,8 @@ static WSAAPI int _ws2_getaddrinfo_bind(const char FAR *node, const char FAR *se ...@@ -518,8 +518,8 @@ static WSAAPI int _ws2_getaddrinfo_bind(const char FAR *node, const char FAR *se
if ((entry == NULL) || (freentry == NULL)) if ((entry == NULL) || (freentry == NULL))
{ {
/* not found, use replacement API instead */ /* not found, use replacement API instead */
entry = getaddrinfo; entry = getaddrinfo;
freentry = freeaddrinfo; freentry = freeaddrinfo;
} }
/* call API before replacing function pointer to avoid crash */ /* call API before replacing function pointer to avoid crash */
result = entry (node, service, hints, res); result = entry (node, service, hints, res);
...@@ -723,9 +723,11 @@ int vlc_inet_pton (int af, const char *src, void *dst) ...@@ -723,9 +723,11 @@ int vlc_inet_pton (int af, const char *src, void *dst)
break; break;
#endif #endif
default: default:
freeaddrinfo (res);
return -1; return -1;
} }
memcpy (dst, data, len); memcpy (dst, data, len);
freeaddrinfo (res);
return 1; return 1;
#else /* HAVE_INET_PTON */ #else /* HAVE_INET_PTON */
return inet_pton( af, src, dst ); return inet_pton( af, src, dst );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment