library.c: fix segfault on socket connect fail by Guido Günther

this should be a fix for phpfpm segaulft as mentioned here: https://github.com/nicolasff/phpredis/issues/399