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:
Viktor Szakats 2025-03-20 13:17:39 +01:00
parent c48c4914a9
commit 554e4c14be
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
5 changed files with 19 additions and 6 deletions

View file

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