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
Merge pull request #2014 from mattsta/fix-hiredis-leak

Fix hiredis getaddrinfo leak