From 3249dfba39196bbbe3fc9d39362081fc118f5822 Mon Sep 17 00:00:00 2001 From: Andreas Wehrmann Date: Thu, 20 Jun 2024 07:21:33 +0200 Subject: [PATCH] make sure to return NULL for the query object when a response is returned from the cache (#3996) --- pjlib-util/src/pjlib-util/resolver.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pjlib-util/src/pjlib-util/resolver.c b/pjlib-util/src/pjlib-util/resolver.c index 1ec8daace..7e76ebcd9 100644 --- a/pjlib-util/src/pjlib-util/resolver.c +++ b/pjlib-util/src/pjlib-util/resolver.c @@ -917,6 +917,12 @@ PJ_DEF(pj_status_t) pj_dns_resolver_start_query( pj_dns_resolver *resolver, cache->ref_cnt++; pj_grp_lock_release(resolver->grp_lock); + /* Since we're returning an answer from cache, + * there is no query object to return. + */ + if (p_query) + *p_query = NULL; + /* This cached response is still valid. Just return this * response to caller. */