Unbound: Fix bad dereference when DHCP lease expires (#4742)

Move deletion of dhcp cache info when the lease expires to after the
last reference to the cache information.

Fixes #4741
This commit is contained in:
Gareth Owen 2021-02-23 02:53:41 -05:00 committed by GitHub
parent a4ae9b3918
commit d344d0a773
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -130,10 +130,10 @@ def run_watcher(target_filename, domain):
"dhcpd expired %s @ %s" % (cached_leases[address]['client-hostname'], address)
)
unbound_control(['local_data_remove', cached_leases[address]['client-hostname']])
del cached_leases[address]
fqdn = '%s.%s' % (cached_leases[address]['client-hostname'], domain)
if unbound_local_data.is_equal(address, fqdn):
unbound_local_data.cleanup(address, fqdn)
del cached_leases[address]
dhcpd_changed = True
if dhcpd_changed: