Fixed potential NULL deref in dns_client
Test: refactoring of udp delivery function