mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'bugfix/smtp_client_v4.4' into 'release/v4.4'
smtp_client: Fix heap leakage (v4.4) See merge request espressif/esp-idf!17794
This commit is contained in:
commit
0c6ad1b7ba
@ -100,6 +100,7 @@ static int write_and_get_response(mbedtls_net_context *sock_fd, unsigned char *b
|
||||
|
||||
do {
|
||||
len = DATA_SIZE - 1;
|
||||
memset(data, 0, DATA_SIZE);
|
||||
ret = mbedtls_net_recv(sock_fd, data, len);
|
||||
|
||||
if (ret <= 0) {
|
||||
@ -153,6 +154,7 @@ static int write_ssl_and_get_response(mbedtls_ssl_context *ssl, unsigned char *b
|
||||
|
||||
do {
|
||||
len = DATA_SIZE - 1;
|
||||
memset(data, 0, DATA_SIZE);
|
||||
ret = mbedtls_ssl_read(ssl, data, len);
|
||||
|
||||
if (ret == MBEDTLS_ERR_SSL_WANT_READ || ret == MBEDTLS_ERR_SSL_WANT_WRITE) {
|
||||
@ -482,8 +484,12 @@ static void smtp_client_task(void *pvParameters)
|
||||
ret = 0; /* No errors */
|
||||
|
||||
exit:
|
||||
mbedtls_ssl_session_reset(&ssl);
|
||||
mbedtls_net_free(&server_fd);
|
||||
mbedtls_x509_crt_free(&cacert);
|
||||
mbedtls_ssl_free(&ssl);
|
||||
mbedtls_ssl_config_free(&conf);
|
||||
mbedtls_ctr_drbg_free(&ctr_drbg);
|
||||
mbedtls_entropy_free(&entropy);
|
||||
|
||||
if (ret != 0) {
|
||||
mbedtls_strerror(ret, buf, 100);
|
||||
|
Loading…
x
Reference in New Issue
Block a user