Don't exit premature from gg_gethostbyname_real()

POSIX.1 [1] says it's undefined effect to use 'return' before pthread_cleanup_pop()

This also fix buf memleak.

[1] The effect of the use of return, break, continue, and goto to prematurely leave a code block described by a pair of pthread_cleanup_push() and pthread_cleanup_pop() functions calls is undefined.
From: http://pubs.opengroup.org/onlinepubs/009695299/functions/pthread_cleanup_pop.html