[vlc-devel] [PATCH 3/4] freeaddrinfo: rewrite as iterative
KO Myung-Hun
komh78 at gmail.com
Wed Dec 3 03:47:02 CET 2014
From: Rémi Denis-Courmont <remi at remlab.net>
(cherry picked from commit 4716a65fc63c00a3970f65848ce3d94809d22ef0)
Signed-off-by: KO Myung-Hun <komh at chollian.net>
---
compat/freeaddrinfo.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/compat/freeaddrinfo.c b/compat/freeaddrinfo.c
index 0d5a1d8..fecc3fa 100644
--- a/compat/freeaddrinfo.c
+++ b/compat/freeaddrinfo.c
@@ -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;
+ }
}
--
1.8.5.2
More information about the vlc-devel
mailing list