From 010502731cfda8ebc13289b658d2d1711b394e04 Mon Sep 17 00:00:00 2001 From: wreuven Date: Tue, 30 May 2023 17:28:20 +0300 Subject: [PATCH] Update client-http.c This bug was triggered for example when the connection closes (e.g. timeout) just as we attempt a new reuse of the connection. Returning 0, means the callers will make use of a now invalid WSI. This often results in a double free of the wsi memory. Need to return -1 --- lib/roles/http/client/client-http.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/roles/http/client/client-http.c b/lib/roles/http/client/client-http.c index 70373bbcd..3f9c7784d 100644 --- a/lib/roles/http/client/client-http.c +++ b/lib/roles/http/client/client-http.c @@ -286,7 +286,7 @@ hs2: lwsl_debug("ERROR writing to client socket\n"); lws_close_free_wsi(wsi, LWS_CLOSE_STATUS_NOSTATUS, "cws"); - return 0; + return -1; // closed wsi so let callers know case LWS_SSL_CAPABLE_MORE_SERVICE: lws_callback_on_writable(wsi); break;