ws: avoid NULL pointer deref in curl_ws_recv

If a NULL easy handle is passed in.

Pointed out by Coverity

Follow-up to 960fb49245

Closes #18065
This commit is contained in:
Daniel Stenberg 2025-07-28 15:54:59 +02:00
parent f7af8adadd
commit 9d2075bdce
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2

View file

@ -1150,7 +1150,7 @@ CURLcode curl_ws_recv(CURL *d, void *buffer,
const struct curl_ws_frame **metap)
{
struct Curl_easy *data = d;
struct connectdata *conn = data->conn;
struct connectdata *conn;
struct websocket *ws;
struct ws_collect ctx;
@ -1159,6 +1159,7 @@ CURLcode curl_ws_recv(CURL *d, void *buffer,
if(!GOOD_EASY_HANDLE(data))
return CURLE_BAD_FUNCTION_ARGUMENT;
conn = data->conn;
if(!conn) {
/* Unhappy hack with lifetimes of transfers and connection */
if(!data->set.connect_only) {