diff --git a/lib/client-handshake.c b/lib/client-handshake.c index f8d0b692..d3d3daaa 100644 --- a/lib/client-handshake.c +++ b/lib/client-handshake.c @@ -80,6 +80,11 @@ struct libwebsocket *__libwebsocket_client_connect_2( if (connect(wsi->sock, (struct sockaddr *)&server_addr, sizeof(struct sockaddr)) == -1) { fprintf(stderr, "Connect failed\n"); +#ifdef WIN32 + closesocket(wsi->sock); +#else + close(wsi->sock); +#endif goto oom4; }