]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Don't use the statslock in the destructor
authorAram Sargsyan <aram@isc.org>
Fri, 22 Sep 2023 16:01:08 +0000 (16:01 +0000)
committerArаm Sаrgsyаn <aram@isc.org>
Tue, 26 Sep 2023 12:23:10 +0000 (12:23 +0000)
Using the 'statslock' mutex in the destructor is useless, because
at this point there shouldn't be any other references to the
structure.

lib/dns/xfrin.c

index d818aca33eb66fd663ff5a1acec5e13dc34517a4..2487b0c72af07736f4fa9e976fd29ab7a37e6330 100644 (file)
@@ -1899,7 +1899,6 @@ xfrin_destroy(dns_xfrin_t *xfr) {
         * Calculate the length of time the transfer took,
         * and print a log message with the bytes and rate.
         */
-       LOCK(&xfr->statslock);
        msecs = isc_time_microdiff(&now, &xfr->start) / 1000;
        if (msecs == 0) {
                msecs = 1;
@@ -1912,8 +1911,6 @@ xfrin_destroy(dns_xfrin_t *xfr) {
                  xfr->nmsg, xfr->nrecs, xfr->nbytes,
                  (unsigned int)(msecs / 1000), (unsigned int)(msecs % 1000),
                  (unsigned int)persec, xfr->end_serial);
-       UNLOCK(&xfr->statslock);
-       isc_mutex_destroy(&xfr->statslock);
 
        if (xfr->dispentry != NULL) {
                dns_dispatch_done(&xfr->dispentry);
@@ -1989,6 +1986,7 @@ xfrin_destroy(dns_xfrin_t *xfr) {
 
        isc_timer_destroy(&xfr->max_idle_timer);
        isc_timer_destroy(&xfr->max_time_timer);
+       isc_mutex_destroy(&xfr->statslock);
 
        isc_mem_putanddetach(&xfr->mctx, xfr, sizeof(*xfr));
 }