Fix calling freeaddrinfo() on the wrong pointer.
authorGuus Sliepen <guus@tinc-vpn.org>
Mon, 22 Jan 2018 17:05:09 +0000 (18:05 +0100)
committerGuus Sliepen <guus@tinc-vpn.org>
Mon, 22 Jan 2018 17:05:09 +0000 (18:05 +0100)
Thanks to Todd C. Miller for finding this issue.

src/address_cache.c

index 552e1f2..42b671b 100644 (file)
@@ -178,8 +178,8 @@ const sockaddr_t *get_recent_address(address_cache_t *cache) {
                cache->aip = cache->aip->ai_next;
 
                if(!cache->aip) {
-                       freeaddrinfo(cache->aip);
-                       cache->aip = NULL;
+                       freeaddrinfo(cache->ai);
+                       cache->ai = cache->aip = NULL;
                }
 
                return sa;