dnsserv_resolved has needless casts, unused strndup.
doors found some more buried treasure:
dnsserv_resolved
casts its argument const char *answer
to char *
before passing it to evdns_server_request_add_a_reply
or evdns_server_request_add_ptr_reply
. In both cases, it is then passed as a const char *
argument to evdns_server_request_add_reply
, so the casts probably aren't dangerous, but they're ugly and should be removed.
dnsserv_resolved
also allocates a copy ans
of answer
before the call to evdns_server_request_add_ptr_reply
, and frees it immediately afterward without using it. This clearly needs to be removed too.