vlc | branch: master | Rémi Denis-Courmont <[email protected]> | Sat Nov 22 
11:20:24 2014 +0200| [4716a65fc63c00a3970f65848ce3d94809d22ef0] | committer: 
Rémi Denis-Courmont

freeaddrinfo: rewrite as iterative

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

 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;
+    }
 }

_______________________________________________
vlc-commits mailing list
[email protected]
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to