esp-tls: Allow esp_tls_conn_delete() to be called with a NULL pointer

This commit is contained in:
Angus Gratton 2018-04-19 11:34:06 +10:00 committed by Angus Gratton
parent fe907bde60
commit 507ca8196c

View file

@ -230,11 +230,13 @@ exit:
*/
void esp_tls_conn_delete(esp_tls_t *tls)
{
mbedtls_cleanup(tls);
if (tls->sockfd) {
close(tls->sockfd);
if (tls != NULL) {
mbedtls_cleanup(tls);
if (tls->sockfd) {
close(tls->sockfd);
}
free(tls);
}
free(tls);
};
static ssize_t tcp_write(esp_tls_t *tls, const char *data, size_t datalen)