mirror of
https://github.com/curl/curl.git
synced 2026-08-25 09:43:32 +03:00
mbedtls: cleanup more without care for 'initialized'
Several mbedTLS resources (entropy/CTR-DRBG, CA/client certs, keys, CRL)
are initialized and may allocate memory before initialized is set, and
must still be cleaned up.
Follow-up to 1c4813c769
Caught by Codex Security
Closes #21440
This commit is contained in:
parent
7c0a8fc210
commit
d19a039472
1 changed files with 7 additions and 7 deletions
|
|
@ -1355,15 +1355,15 @@ static void mbedtls_close(struct Curl_cfilter *cf, struct Curl_easy *data)
|
|||
|
||||
(void)data;
|
||||
DEBUGASSERT(backend);
|
||||
if(backend->initialized) {
|
||||
mbedtls_pk_free(&backend->pk);
|
||||
mbedtls_x509_crt_free(&backend->clicert);
|
||||
mbedtls_x509_crt_free(&backend->cacert);
|
||||
mbedtls_pk_free(&backend->pk);
|
||||
mbedtls_x509_crt_free(&backend->clicert);
|
||||
mbedtls_x509_crt_free(&backend->cacert);
|
||||
#ifdef MBEDTLS_X509_CRL_PARSE_C
|
||||
mbedtls_x509_crl_free(&backend->crl);
|
||||
mbedtls_x509_crl_free(&backend->crl);
|
||||
#endif
|
||||
curlx_safefree(backend->ciphersuites);
|
||||
mbedtls_ssl_config_free(&backend->config);
|
||||
curlx_safefree(backend->ciphersuites);
|
||||
mbedtls_ssl_config_free(&backend->config);
|
||||
if(backend->initialized) {
|
||||
mbedtls_ssl_free(&backend->ssl);
|
||||
backend->initialized = FALSE;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue