]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
resolved: size the mdns announce answer array properly
authorLennart Poettering <lennart@poettering.net>
Mon, 13 Feb 2017 19:45:40 +0000 (20:45 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 14 Feb 2017 10:13:48 +0000 (11:13 +0100)
The array doesn't grow dynamically, hence pick the right size at the
moment of allocation. Let's simply multiply the number of addresses of
this link by 2, as that's how many RRs we maintain for it.

src/resolve/resolved-dns-scope.c

index ac09192c3a3b88e6e438f4876a3eae4256e06193..ffaefbe3f2b92b3c7d3278e277e8cb39df993418 100644 (file)
@@ -1077,7 +1077,7 @@ int dns_scope_announce(DnsScope *scope, bool goodbye) {
         if (scope->protocol != DNS_PROTOCOL_MDNS)
                 return 0;
 
-        answer = dns_answer_new(4);
+        answer = dns_answer_new(scope->link->n_addresses * 2);
         if (!answer)
                 return log_oom();