dnsmasq: fix a race condition possibly leading to lockup