From: Lennart Poettering Date: Mon, 13 Feb 2017 19:45:40 +0000 (+0100) Subject: resolved: size the mdns announce answer array properly X-Git-Tag: v233~98^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fc0195fabf1505d50271c7579657dacd98ad7904;p=thirdparty%2Fsystemd.git resolved: size the mdns announce answer array properly 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. --- diff --git a/src/resolve/resolved-dns-scope.c b/src/resolve/resolved-dns-scope.c index ac09192c3a3..ffaefbe3f2b 100644 --- a/src/resolve/resolved-dns-scope.c +++ b/src/resolve/resolved-dns-scope.c @@ -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();