diff --git a/lib/client-handshake.c b/lib/client-handshake.c
index 7293a410c62944d4cc50b94640903e1eb7020617..0623f51936058bfb74c64830391a4bbf1b8377ce 100644
--- a/lib/client-handshake.c
+++ b/lib/client-handshake.c
@@ -155,6 +155,11 @@ struct libwebsocket *libwebsocket_client_connect_2(
 		if (insert_wsi_socket_into_fds(context, wsi))
 			goto oom4;
 
+		/*
+		 * past here, we can't simply free the structs as error
+		 * handling as oom4 does.  We have to run the whole close flow.
+		 */
+
 		libwebsocket_set_timeout(wsi,
 			PENDING_TIMEOUT_AWAITING_CONNECT_RESPONSE,
 							      AWAITING_TIMEOUT);
@@ -219,7 +224,7 @@ struct libwebsocket *libwebsocket_client_connect_2(
 			 * about the connect completion
 			 */
 			if (lws_change_pollfd(wsi, 0, LWS_POLLOUT))
-				goto oom4;
+				goto failed;
 			lws_libev_io(context, wsi, LWS_EV_START | LWS_EV_WRITE);
 
 			return wsi;