mirror of
https://github.com/curl/curl.git
synced 2026-07-24 13:57:16 +03:00
windows: fix issues detected by clang-tidy, and some more
- digest_sspi: memory leak.
- digest_sspi: free buffers on `calloc()` fail.
(not detected by clang-tidy)
- schannel_verify: avoid a `NULL` `alt_name_info`.
- schannel: fix potential `NULL` deref for `backend->cred`.
- schannel: fix uninitialized result value.
Follow-up to 7f4c358541 #3197
- schannel: drop unused assigment.
- tool_doswin: drop unused assigment.
- testutil: fix memory leak on error.
- testutil: fix memory leak on non-error.
(not detected by clang-tidy)
Cherry-picked from #16764
Closes #16777
This commit is contained in:
parent
c48c4914a9
commit
554e4c14be
5 changed files with 19 additions and 6 deletions
|
|
@ -582,8 +582,12 @@ CURLcode Curl_auth_create_digest_http_message(struct Curl_easy *data,
|
|||
|
||||
/* Allocate our new context handle */
|
||||
digest->http_context = calloc(1, sizeof(CtxtHandle));
|
||||
if(!digest->http_context)
|
||||
if(!digest->http_context) {
|
||||
curlx_unicodefree(spn);
|
||||
Curl_sspi_free_identity(p_identity);
|
||||
free(output_token);
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
/* Generate our response message */
|
||||
status = Curl_pSecFn->InitializeSecurityContext(&credentials, NULL,
|
||||
|
|
|
|||
|
|
@ -975,7 +975,7 @@ schannel_connect_step1(struct Curl_cfilter *cf, struct Curl_easy *data)
|
|||
if(!backend->cred) {
|
||||
char *snihost;
|
||||
result = schannel_acquire_credential_handle(cf, data);
|
||||
if(result)
|
||||
if(result || !backend->cred)
|
||||
return result;
|
||||
/* schannel_acquire_credential_handle() sets backend->cred accordingly or
|
||||
it returns error otherwise. */
|
||||
|
|
@ -1631,6 +1631,7 @@ schannel_connect_step3(struct Curl_cfilter *cf, struct Curl_easy *data)
|
|||
args.data = data;
|
||||
args.idx = 0;
|
||||
args.certs_count = certs_count;
|
||||
args.result = CURLE_OK;
|
||||
traverse_cert_store(ccert_context, add_cert_to_certinfo, &args);
|
||||
result = args.result;
|
||||
}
|
||||
|
|
@ -1941,7 +1942,6 @@ schannel_recv(struct Curl_cfilter *cf, struct Curl_easy *data,
|
|||
backend->encdata_offset),
|
||||
size, err);
|
||||
if(*err) {
|
||||
nread = -1;
|
||||
if(*err == CURLE_AGAIN)
|
||||
SCH_DEV(infof(data, "schannel: recv returned CURLE_AGAIN"));
|
||||
else if(*err == CURLE_RECV_ERROR)
|
||||
|
|
|
|||
|
|
@ -399,6 +399,9 @@ static DWORD cert_get_name_string(struct Curl_easy *data,
|
|||
(void)Win8_compat;
|
||||
#endif
|
||||
|
||||
if(!alt_name_info)
|
||||
return 0;
|
||||
|
||||
compute_content = host_names != NULL && length != 0;
|
||||
|
||||
/* Initialize default return values. */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue