From c84dca6e7d65c52cd5abe3d613fdb9f0bd0f0ba7 Mon Sep 17 00:00:00 2001 From: "harshal.patil" Date: Tue, 12 Mar 2024 13:48:06 +0530 Subject: [PATCH] fix(tcp_transport): Fix coverity report regarding tcp_transport --- components/tcp_transport/transport_ssl.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/components/tcp_transport/transport_ssl.c b/components/tcp_transport/transport_ssl.c index ca3552fc76..b11d70a7fa 100644 --- a/components/tcp_transport/transport_ssl.c +++ b/components/tcp_transport/transport_ssl.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -109,8 +109,11 @@ static int ssl_connect(esp_transport_handle_t t, const char *host, int port, int if (esp_tls_conn_new_sync(host, strlen(host), port, &ssl->cfg, ssl->tls) <= 0) { ESP_LOGE(TAG, "Failed to open a new connection"); esp_tls_error_handle_t esp_tls_error_handle; - esp_tls_get_error_handle(ssl->tls, &esp_tls_error_handle); - esp_transport_set_errors(t, esp_tls_error_handle); + if (esp_tls_get_error_handle(ssl->tls, &esp_tls_error_handle) == ESP_OK) { + esp_transport_set_errors(t, esp_tls_error_handle); + } else { + ESP_LOGE(TAG, "Error in obtaining the error handle"); + } goto exit_failure; }