From fe7fdc2bed6f629ee99d66d9743ebb2d8a1b88de Mon Sep 17 00:00:00 2001 From: zhangjunhao Date: Wed, 18 Apr 2018 18:30:45 +0800 Subject: [PATCH] fix(tcpip_adapter): Fix netif mac addr is not zero before init --- components/tcpip_adapter/tcpip_adapter_wifi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/tcpip_adapter/tcpip_adapter_wifi.c b/components/tcpip_adapter/tcpip_adapter_wifi.c index 7202f0b9..5b556023 100644 --- a/components/tcpip_adapter/tcpip_adapter_wifi.c +++ b/components/tcpip_adapter/tcpip_adapter_wifi.c @@ -98,7 +98,7 @@ void tcpip_adapter_start(uint8_t netif_index, bool authed) if (netif_index == TCPIP_ADAPTER_IF_STA) { if (authed == 0) { if (esp_netif[netif_index] == NULL) { - esp_netif[netif_index] = (struct netif*)os_malloc(sizeof(*esp_netif[netif_index])); + esp_netif[netif_index] = (struct netif*)os_zalloc(sizeof(*esp_netif[netif_index])); TCPIP_ATAPTER_LOG("Malloc netif:%d\n", netif_index); TCPIP_ATAPTER_LOG("Add netif:%d\n", netif_index); netif_add(esp_netif[netif_index], NULL, NULL, NULL, NULL, ethernetif_init, tcpip_input); @@ -132,7 +132,7 @@ void tcpip_adapter_start(uint8_t netif_index, bool authed) if (esp_netif[netif_index] == NULL) { TCPIP_ATAPTER_LOG("Malloc netif:%d\n", netif_index); - esp_netif[netif_index] = (struct netif*)os_malloc(sizeof(*esp_netif[netif_index])); + esp_netif[netif_index] = (struct netif*)os_zalloc(sizeof(*esp_netif[netif_index])); netif_add(esp_netif[netif_index], &esp_ip[TCPIP_ADAPTER_IF_AP].ip, &esp_ip[TCPIP_ADAPTER_IF_AP].netmask, &esp_ip[TCPIP_ADAPTER_IF_AP].gw, NULL, ethernetif_init, tcpip_input); }