Fix a locking error in bufferevent_socket_get_dns_error.

Patch from Ka-Hing Cheung.
Merge remote-tracking branch 'origin/patches-2.0'