Skip to content

Commit

Permalink
freeaddrinfo: rewrite as iterative
Browse files Browse the repository at this point in the history
(cherry picked from commit 4716a65fc63c00a3970f65848ce3d94809d22ef0)
Signed-off-by: KO Myung-Hun <komh@chollian.net>
Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
  • Loading branch information
Rémi Denis-Courmont authored and jbkempf committed Dec 3, 2014
1 parent de5943f commit 831d797
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions compat/freeaddrinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,13 @@
*/
void freeaddrinfo (struct addrinfo *res)
{
if (res == NULL)
return;
while (res != NULL)
{
struct addrinfo *next = res->ai_next;

freeaddrinfo (res->ai_next);

free (res->ai_canonname);
free (res->ai_addr);
free (res);
free (res->ai_canonname);
free (res->ai_addr);
free (res);
res = next;
}
}

0 comments on commit 831d797

Please sign in to comment.