1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

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
This commit is contained in:
wreuven 2023-05-30 17:28:20 +03:00 committed by GitHub
parent e8eb7d6bd6
commit 010502731c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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;