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 552e1f2885a62c1fea7017ca92dde2b5b883b31a..42b671b8990208c5d402f9f6005c1450cbc7b19e 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;