]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
resolve: fix possible memleak
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 5 Feb 2022 13:03:19 +0000 (22:03 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 8 Feb 2022 08:38:42 +0000 (17:38 +0900)
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.

src/resolve/resolved-dns-stub.c

index 992ae19bbc74c1142a00ac87d8b79764716aaa6b..d76021358832e4c66e0cf0c485fdbafc2eed4123 100644 (file)
@@ -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;
                         }