mirror of
https://github.com/isc-projects/bind9.git
synced 2026-05-28 04:34:54 -04:00
Take 'env' reference before async calling perform_reopen()
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.
(cherry picked from commit 48d7401f0d)
This commit is contained in:
parent
77d60acb86
commit
99b583592e
1 changed files with 3 additions and 0 deletions
|
|
@ -685,6 +685,8 @@ perform_reopen(void *arg) {
|
|||
LOCK(&env->reopen_lock);
|
||||
env->reopen_queued = false;
|
||||
UNLOCK(&env->reopen_lock);
|
||||
|
||||
dns_dtenv_detach(&env);
|
||||
}
|
||||
|
||||
/*%
|
||||
|
|
@ -716,6 +718,7 @@ check_file_size_and_maybe_reopen(dns_dtenv_t *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;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue