Add some missing freeaddrinfo() calls to avoid leaking memory.
authorTodd C. Miller <Todd.Miller@courtesan.com>
Mon, 22 Jan 2018 17:27:16 +0000 (10:27 -0700)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Mon, 22 Jan 2018 17:27:16 +0000 (10:27 -0700)
src/invitation.c
src/net_setup.c

index c667a6edfde72b8b49fe79b4a585fe7911d4890e..4a262a82ab862042ff49496fe9c6f20b153ddfe4 100644 (file)
@@ -1201,6 +1201,7 @@ next:
                aip = aip->ai_next;
 
                if(!aip) {
+                       freeaddrinfo(ai);
                        return 1;
                }
        }
@@ -1246,6 +1247,8 @@ next:
                goto next;
        }
 
+       freeaddrinfo(ai);
+
        // Check if the hash of the key he gave us matches the hash in the URL.
        char *fingerprint = line + 2;
        char hishash[64];
index 4f9d738f7c9498d3876cbe98fd4c4becf39b2416..17675aec40ace0b3f8d775875c54321961206e55 100644 (file)
@@ -902,6 +902,7 @@ static bool setup_myself(void) {
 
                free(myport);
                memcpy(&sa, ai->ai_addr, ai->ai_addrlen);
+               freeaddrinfo(ai);
                sockaddr2str(&sa, NULL, &myport);
        }