From: Yu Watanabe Date: Sat, 5 Feb 2022 13:03:19 +0000 (+0900) Subject: resolve: fix possible memleak X-Git-Tag: v251-rc1~336^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fe8c5ce615ee2123f17b1f0b3728c439e19e4b5b;p=thirdparty%2Fsystemd.git resolve: fix possible memleak Fortunately, unlike the issue fixed in the previous commit, the memleak should be superficial and not become apparent, as the queries handled here are managed by the stub stream, and will be freed when the stream is closed. Just for safety, and slightly reducing the runtime memory usage by the stub stream. --- diff --git a/src/resolve/resolved-dns-stub.c b/src/resolve/resolved-dns-stub.c index 992ae19bbc7..d7602135883 100644 --- a/src/resolve/resolved-dns-stub.c +++ b/src/resolve/resolved-dns-stub.c @@ -791,8 +791,10 @@ static void dns_stub_query_complete(DnsQuery *q) { * packet doesn't answer our question. In that case let's restart the query, * now with the redirected question. We'll */ r = dns_query_go(q); - if (r < 0) + if (r < 0) { log_debug_errno(r, "Failed to restart query: %m"); + dns_query_free(q); + } return; }