schannel: assign result before using it

curl_easy_strerror(result) was called *before* result was assigned.

Reported in Joshua's sarif data

Closes #18642
This commit is contained in:
Daniel Stenberg 2025-09-20 17:14:10 +02:00
parent 82eeda1041
commit 94eec0a788
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2

View file

@ -2451,9 +2451,9 @@ static CURLcode schannel_shutdown(struct Curl_cfilter *cf,
Curl_pSecFn->FreeContextBuffer(outbuf.pvBuffer);
if(!result) {
if(written < outbuf.cbBuffer) {
result = CURLE_SEND_ERROR;
failf(data, "schannel: failed to send close msg: %s"
" (bytes written: %zu)", curl_easy_strerror(result), written);
result = CURLE_SEND_ERROR;
goto out;
}
backend->sent_shutdown = TRUE;
@ -2466,8 +2466,8 @@ static CURLcode schannel_shutdown(struct Curl_cfilter *cf,
}
else {
if(!backend->recv_connection_closed) {
failf(data, "schannel: error sending close msg: %d", result);
result = CURLE_SEND_ERROR;
failf(data, "schannel: error sending close msg: %d", result);
goto out;
}
/* Looks like server already closed the connection.