]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Use attach()/detach() functions instead of touching .references
authorOndřej Surý <ondrej@isc.org>
Wed, 27 Nov 2024 13:12:50 +0000 (14:12 +0100)
committerOndřej Surý <ondrej@isc.org>
Wed, 27 Nov 2024 20:17:22 +0000 (21:17 +0100)
In rbtdb.c, there were two places where the code touched .references
directly instead of using the helper functions.  Use the helper
functions instead.

lib/dns/rbtdb.c

index 65c66dec6faefd3409d15c4d331172f53431ea23..3e6c0317332aa822425216458fc3fe009f10e510 100644 (file)
@@ -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);
        }
 }
 
@@ -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);