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 <dongshengyuan@uniontech.com>
This commit is contained in:
dongshengyuan
2026-06-22 11:21:47 +01:00
committed by Luca Boccassi
parent 6b158b72f5
commit 5e39866868
+2
View File
@@ -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;
}
}