Skip to content

Commit

Permalink
[9.18] fix: dev: Use attach()/detach() functions instead of touching …
Browse files Browse the repository at this point in the history
….references

In rbtdb.c, there were two places where the code touched .references
directly instead of using the helper functions.  Use the helper
functions instead.

Forward port from https://gitlab.isc.org/isc-private/bind9/-/merge_requests/753

Merge branch 'ondrej/use-attach-detach-in-rbtdb-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!9796
  • Loading branch information
each committed Nov 27, 2024
2 parents 60be885 + a4e3d25 commit 9712d00
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions lib/dns/rbtdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -2483,10 +2483,7 @@ cleanup_dead_nodes_callback(isc_task_t *task, isc_event_t *event) {
isc_task_send(task, &event);
} else {
isc_event_free(&event);
if (isc_refcount_decrement(&rbtdb->references) == 1) {
(void)isc_refcount_current(&rbtdb->references);
maybe_free_rbtdb(rbtdb);
}
detach((dns_db_t **)&rbtdb);
}
}

Expand Down Expand Up @@ -2749,7 +2746,7 @@ closeversion(dns_db_t *db, dns_dbversion_t **versionp, bool commit) {
sizeof(*changed));
}
if (event != NULL) {
isc_refcount_increment(&rbtdb->references);
attach((dns_db_t *)rbtdb, &(dns_db_t *){ NULL });
isc_task_send(rbtdb->task, &event);
} else {
RWUNLOCK(&rbtdb->tree_lock, isc_rwlocktype_write);
Expand Down

0 comments on commit 9712d00

Please sign in to comment.