2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 14:07:59 +00:00

Remove potential use after free (fctx) in rctx_resend.

This commit is contained in:
Mark Andrews 2019-08-28 11:34:22 +10:00
parent b125b7031c
commit c3bcb4d47a

View File

@ -9345,6 +9345,8 @@ rctx_resend(respctx_t *rctx, dns_adbaddrinfo_t *addrinfo) {
isc_result_t result;
fetchctx_t *fctx = rctx->fctx;
bool bucket_empty;
dns_resolver_t *res = fctx->res;
unsigned int bucketnum;
FCTXTRACE("resend");
inc_stats(fctx->res, dns_resstatscounter_retry);
@ -9354,12 +9356,13 @@ rctx_resend(respctx_t *rctx, dns_adbaddrinfo_t *addrinfo) {
return;
}
bucketnum = fctx->bucketnum;
fctx_done(fctx, result, __LINE__);
LOCK(&fctx->res->buckets[fctx->bucketnum].lock);
LOCK(&res->buckets[bucketnum].lock);
bucket_empty = fctx_decreference(fctx);
UNLOCK(&fctx->res->buckets[fctx->bucketnum].lock);
UNLOCK(&res->buckets[bucketnum].lock);
if (bucket_empty) {
empty_bucket(fctx->res);
empty_bucket(res);
}
}