From: Frantisek Sumsal Date: Thu, 4 Jan 2024 15:48:10 +0000 (+0100) Subject: resolve: initialize `r` during OOM X-Git-Tag: v256-rc1~1287^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5169f8cfd543cbce498871527ea8aa454ff2c252;p=thirdparty%2Fsystemd.git resolve: initialize `r` during OOM Otherwise we'd use some garbage value in the error path. ../src/resolve/resolved-dns-query.c: In function ‘dns_query_accept’: ../src/resolve/resolved-dns-query.c:944:27: error: ‘r’ may be used uninitialized in this function [-Werror=maybe-uninitialized] 944 | q->answer_errno = -r; | ^~ cc1: all warnings being treated as errors Follow-up for 9ca133e97a0. --- diff --git a/src/resolve/resolved-dns-query.c b/src/resolve/resolved-dns-query.c index d94fe1da997..a7bc45838f7 100644 --- a/src/resolve/resolved-dns-query.c +++ b/src/resolve/resolved-dns-query.c @@ -902,7 +902,7 @@ static void dns_query_accept(DnsQuery *q, DnsQueryCandidate *c) { if (t->answer_ede_msg) { answer_ede_msg = strdup(t->answer_ede_msg); if (!answer_ede_msg) { - log_oom(); + r = log_oom(); goto fail; } }