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