schannel: clean up better on Curl_conn_cf_send() error

Fixes #19241
Reported-by: Joshua Rogers
This commit is contained in:
Daniel Stenberg 2025-10-25 23:03:31 +02:00
parent fb0c014e30
commit 7bfc2b8a54
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2

View file

@ -1128,7 +1128,7 @@ schannel_connect_step2(struct Curl_cfilter *cf, struct Curl_easy *data)
SecBuffer inbuf[2];
SecBufferDesc inbuf_desc;
SECURITY_STATUS sspi_status = SEC_E_OK;
CURLcode result;
CURLcode result = CURLE_OK;
bool doread;
const char *pubkey_ptr;
@ -1301,15 +1301,18 @@ schannel_connect_step2(struct Curl_cfilter *cf, struct Curl_easy *data)
if(result || (outbuf[i].cbBuffer != written)) {
failf(data, "schannel: failed to send next handshake data: "
"sent %zu of %lu bytes", written, outbuf[i].cbBuffer);
return CURLE_SSL_CONNECT_ERROR;
result = CURLE_SSL_CONNECT_ERROR;
break;
}
}
/* free obsolete buffer */
if(outbuf[i].pvBuffer) {
Curl_pSecFn->FreeContextBuffer(outbuf[i].pvBuffer);
}
}
for(i = 0; i < 3; i++) {
/* free obsolete buffer */
if(outbuf[i].pvBuffer)
Curl_pSecFn->FreeContextBuffer(outbuf[i].pvBuffer);
}
if(result)
return result;
}
else {
char buffer[STRERROR_LEN];