schannel: fix potental memory leak of cert_store_path on four error paths

Closes #19423
This commit is contained in:
x2018 2025-11-09 22:20:24 +08:00 committed by Daniel Stenberg
parent 87149c8383
commit baafa5ff76
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2

View file

@ -580,6 +580,7 @@ schannel_acquire_credential_handle(struct Curl_cfilter *cf,
failf(data, "schannel: certificate format compatibility error "
" for %s",
blob ? "(memory blob)" : data->set.ssl.primary.clientcert);
free(cert_store_path);
curlx_unicodefree(cert_path);
if(fInCert)
curlx_fclose(fInCert);
@ -597,6 +598,7 @@ schannel_acquire_credential_handle(struct Curl_cfilter *cf,
int cert_find_flags;
const char *cert_showfilename_error = blob ?
"(memory blob)" : data->set.ssl.primary.clientcert;
free(cert_store_path);
curlx_unicodefree(cert_path);
if(fInCert) {
long cert_tell = 0;