diff --git a/lib/sntllv2.c b/lib/sntllv2.c index ecfd63a..dd31962 100644 --- a/lib/sntllv2.c +++ b/lib/sntllv2.c @@ -513,7 +513,9 @@ static void __connection_destroy(conn_t *co) if(co->pctx->login) free(co->pctx->login); if(co->pctx->passwd) free(co->pctx->passwd); - SSL_shutdown(co->ssl); + while((fd = SSL_shutdown(co->ssl)) != 1) { + if(fd < 0) break; + } fd = SSL_get_fd(co->ssl); SSL_free(co->ssl); SSL_CTX_free(co->ctx); @@ -1085,13 +1087,17 @@ conn_t *connection_link(conn_sys_t *ssys, const char *host, /* resolve host */ #ifdef WIN32 host_ = gethostbyname(host); + if(!host_) { + r = SNE_FAILED; + goto __fail; + } #else r = __resolvehost(host, hostbuf, 2048, &host_); -#endif if(r) { r = SNE_FAILED; goto __fail; } +#endif /* create a socket */ sck = socket(PF_INET, SOCK_STREAM, 0);