From: dongshengyuan <545258830@qq.com> Date: Mon, 22 Jun 2026 06:13:11 +0000 (+0800) Subject: resolve: fix transaction leak in dns_transaction_new() error path X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5e398668689cb70512b856d4f46f5abc8e0b74cd;p=thirdparty%2Fsystemd.git resolve: fix transaction leak in dns_transaction_new() error path hashmap_replace() failure left t in s->manager->dns_transactions with t->scope still NULL, causing the destructor to skip hashmap_remove(). Add the missing cleanup mirroring the earlier error path in the same function. Signed-off-by: dongshengyuan --- diff --git a/src/resolve/resolved-dns-transaction.c b/src/resolve/resolved-dns-transaction.c index a14aa0de7db..cbfe24ee7e8 100644 --- a/src/resolve/resolved-dns-transaction.c +++ b/src/resolve/resolved-dns-transaction.c @@ -326,6 +326,8 @@ int dns_transaction_new( r = hashmap_replace(s->transactions_by_key, first->key, first); if (r < 0) { LIST_REMOVE(transactions_by_key, first, t); + hashmap_remove(s->manager->dns_transactions, UINT_TO_PTR(t->id)); + t->id = 0; return r; } }