From 3f6a66689410910ef601a4d26f10a24f331ef83c Mon Sep 17 00:00:00 2001 From: Michael Graff Date: Tue, 19 Oct 1999 21:42:56 +0000 Subject: [PATCH] Clean up zoneinfo when freeing the entry. This makes more sense, since we will always want to do this anyway, and less code duplication means less places to forget to do it. --- lib/dns/adb.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/dns/adb.c b/lib/dns/adb.c index 166616271e..a483bc1321 100644 --- a/lib/dns/adb.c +++ b/lib/dns/adb.c @@ -410,7 +410,6 @@ dec_entry_refcnt(dns_adb_t *adb, dns_adbentry_t *entry, isc_boolean_t lock) { int bucket; isc_boolean_t destroy_entry; - dns_adbzoneinfo_t *zi; bucket = entry->lock_bucket; @@ -433,12 +432,6 @@ dec_entry_refcnt(dns_adb_t *adb, dns_adbentry_t *entry, isc_boolean_t lock) return; entry->lock_bucket = DNS_ADB_INVALIDBUCKET; - zi = ISC_LIST_HEAD(entry->zoneinfo); - while (zi != NULL) { - ISC_LIST_UNLINK(entry->zoneinfo, zi, link); - free_adbzoneinfo(adb, &zi); - zi = ISC_LIST_HEAD(entry->zoneinfo); - } free_adbentry(adb, &entry); } @@ -586,6 +579,7 @@ static inline void free_adbentry(dns_adb_t *adb, dns_adbentry_t **entry) { dns_adbentry_t *e; + dns_adbzoneinfo_t *zi; INSIST(entry != NULL && DNS_ADBENTRY_VALID(*entry)); e = *entry; @@ -597,6 +591,14 @@ free_adbentry(dns_adb_t *adb, dns_adbentry_t **entry) INSIST(!ISC_LINK_LINKED(e, link)); e->magic = 0; + + zi = ISC_LIST_HEAD(e->zoneinfo); + while (zi != NULL) { + ISC_LIST_UNLINK(e->zoneinfo, zi, link); + free_adbzoneinfo(adb, &zi); + zi = ISC_LIST_HEAD(e->zoneinfo); + } + isc_mempool_put(adb->emp, e); }