From 5e398668689cb70512b856d4f46f5abc8e0b74cd Mon Sep 17 00:00:00 2001 From: dongshengyuan <545258830@qq.com> Date: Mon, 22 Jun 2026 14:13:11 +0800 Subject: [PATCH] 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 --- src/resolve/resolved-dns-transaction.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/resolve/resolved-dns-transaction.c b/src/resolve/resolved-dns-transaction.c index a14aa0de7d..cbfe24ee7e 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; } }