The 'env' pointer is passed to an async function without taking
a reference first, which can potentially cause a use-after-free
error. Take a reference, then detach in the async function.
LOCK(&env->reopen_lock);
env->reopen_queued = false;
UNLOCK(&env->reopen_lock);
+
+ dns_dtenv_detach(&env);
}
/*%
* Send an event to roll the output file, then disallow output file
* rolling until the roll we queue is completed.
*/
+ dns_dtenv_ref(env);
isc_async_run(env->loop, perform_reopen, env);
env->reopen_queued = true;