From cf63cb1136449625fe3279924fde215f6498ccfd Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Tue, 5 Sep 2023 09:46:05 +1000 Subject: [PATCH] Restore dns_validator_destroy and fetchctx_detach call order 7a78a85b moved the destruction of the validator from near the start validated to the end. This reversed the order of dns_validator_destroy and fetchctx_detach. Restore the order so that val->name remains valid for the lifetime of the validator. --- lib/dns/resolver.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/dns/resolver.c b/lib/dns/resolver.c index fb1e401e78..d017c2b3b0 100644 --- a/lib/dns/resolver.c +++ b/lib/dns/resolver.c @@ -5622,9 +5622,14 @@ cleanup_fetchctx: fctx_done_unref(fctx, result); } + /* + * val->name points to name on a message on one of the + * queries on the fetch context so the validator has to + * be destroyed first. + */ + dns_validator_destroy(&val); fetchctx_detach(&fctx); INSIST(node == NULL); - dns_validator_destroy(&val); } static void