Merge branch 'bugfix/fix_socket_leak_v4.3' into 'release/v4.3'

esp-tls: socket will be set to -1 and will not be closed (backport v4.3)

See merge request espressif/esp-idf!20350
This commit is contained in:
Mahavir Jain 2022-09-27 18:18:07 +08:00
commit 07251a99f1

View File

@ -202,8 +202,11 @@ void esp_mbedtls_conn_delete(esp_tls_t *tls)
if (tls != NULL) {
esp_mbedtls_cleanup(tls);
if (tls->is_tls) {
mbedtls_net_free(&tls->server_fd);
tls->sockfd = tls->server_fd.fd;
if (tls->server_fd.fd != -1) {
mbedtls_net_free(&tls->server_fd);
/* Socket is already closed by `mbedtls_net_free` and hence also change assignment of its copy to an invalid value */
tls->sockfd = -1;
}
}
}
}