Fix resource leak in DnsNameResolver