Fix hiredis getaddrinfo leak

Fixed in Redis by 1a5e5b6, but since that part of code
is largely copy/paste from Redis, the fix needs to be
ported over too.

Closes #2012
Redis 2.8.17
Merge tag '2.8.17' into viki

Redis 2.8.17.