Commit 3f6a6668 authored by Michael Graff's avatar Michael Graff
Browse files

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.
parent f00d96a1
......@@ -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);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment