mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
tcp_transport: Fix NULL pointer dereference in esp_transport_esp_tls_create
Add missing NULL checking to prevent NULL pointer dereference if calloc failed. Signed-off-by: Axel Lin <axel.lin@gmail.com>
This commit is contained in:
parent
dd491ee851
commit
9d07e89f13
@ -446,6 +446,9 @@ esp_transport_handle_t esp_transport_ssl_init(void)
|
|||||||
struct transport_esp_tls* esp_transport_esp_tls_create(void)
|
struct transport_esp_tls* esp_transport_esp_tls_create(void)
|
||||||
{
|
{
|
||||||
transport_esp_tls_t *transport_esp_tls = calloc(1, sizeof(transport_esp_tls_t));
|
transport_esp_tls_t *transport_esp_tls = calloc(1, sizeof(transport_esp_tls_t));
|
||||||
|
if (transport_esp_tls == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
transport_esp_tls->sockfd = INVALID_SOCKET;
|
transport_esp_tls->sockfd = INVALID_SOCKET;
|
||||||
return transport_esp_tls;
|
return transport_esp_tls;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user