2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-28 13:08:06 +00:00

Add missing isc_refcount_destroy() for isc__nmsocket_t

The destructor for the isc__nmsocket_t was missing call to the
isc_refcount_destroy() on the reference counter, which might lead to
spurious ThreadSanitizer data race warnings if we ever change the
acquire-release memory order in the isc_refcount_decrement().
This commit is contained in:
Ondřej Surý 2022-08-29 13:42:14 +02:00
parent 9b8d432403
commit b1026dd4c1
No known key found for this signature in database
GPG Key ID: 2820F37E873DEA41

View File

@ -665,6 +665,8 @@ nmsocket_cleanup(isc_nmsocket_t *sock, bool dofree FLARG) {
"\n",
sock, isc_refcount_current(&sock->references));
isc_refcount_destroy(&sock->references);
isc__nm_decstats(sock, STATID_ACTIVE);
atomic_store(&sock->destroying, true);
@ -675,7 +677,9 @@ nmsocket_cleanup(isc_nmsocket_t *sock, bool dofree FLARG) {
* so we can clean up and free the children.
*/
for (size_t i = 0; i < sock->nchildren; i++) {
if (!atomic_load(&sock->children[i].destroying)) {
REQUIRE(!atomic_load(&sock->children[i].destroying));
if (isc_refcount_decrement(
&sock->children[i].references)) {
nmsocket_cleanup(&sock->children[i],
false FLARG_PASS);
}