Commit 831d7979 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont Committed by Jean-Baptiste Kempf

freeaddrinfo: rewrite as iterative

(cherry picked from commit 4716a65fc63c00a3970f65848ce3d94809d22ef0)
Signed-off-by: default avatarKO Myung-Hun <komh@chollian.net>
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent de5943f9
...@@ -34,12 +34,13 @@ ...@@ -34,12 +34,13 @@
*/ */
void freeaddrinfo (struct addrinfo *res) void freeaddrinfo (struct addrinfo *res)
{ {
if (res == NULL) while (res != NULL)
return; {
struct addrinfo *next = res->ai_next;
freeaddrinfo (res->ai_next); free (res->ai_canonname);
free (res->ai_addr);
free (res->ai_canonname); free (res);
free (res->ai_addr); res = next;
free (res); }
} }
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