Fix a locking error in bufferevent_socket_get_dns_error.

Patch from Ka-Hing Cheung.