Add some missing freeaddrinfo() calls to avoid leaking memory.
[tinc] / src / invitation.c
index 5dc8c63..4a262a8 100644 (file)
@@ -1065,7 +1065,7 @@ static bool invitation_receive(void *handle, uint8_t type, const void *msg, uint
                return finalize_join();
 
        case 2:
-               fprintf(stderr, "Invitation succesfully accepted.\n");
+               fprintf(stderr, "Invitation successfully accepted.\n");
                shutdown(sock, SHUT_RDWR);
                success = true;
                break;
@@ -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];