diff options
| author | David Lin <[email protected]> | 2020-06-10 23:27:25 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2020-06-10 23:27:25 +0800 |
| commit | 8beb4399266a81162483b23dfcda19c067297929 (patch) | |
| tree | 996cbe1d6c38735d351bb28c6b02c0c4f616ef8b /components | |
| parent | 4f53c68b3b7729642a328b0d79a20efdc85b4e6d (diff) | |
Update ethernetif.c
Diffstat (limited to 'components')
| -rw-r--r-- | components/net/lwip-2.0.2/src/netif/ethernetif.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/components/net/lwip-2.0.2/src/netif/ethernetif.c b/components/net/lwip-2.0.2/src/netif/ethernetif.c index 8d69897a4b..2fa528aa0d 100644 --- a/components/net/lwip-2.0.2/src/netif/ethernetif.c +++ b/components/net/lwip-2.0.2/src/netif/ethernetif.c @@ -494,20 +494,15 @@ rt_err_t eth_device_init_with_flag(struct eth_device *dev, const char *name, rt_ #if LWIP_NETIF_HOSTNAME #define LWIP_HOSTNAME_LEN 16 char *hostname = RT_NULL; - netif = (struct netif*) rt_malloc (sizeof(struct netif) + LWIP_HOSTNAME_LEN); + netif = (struct netif*) rt_calloc (1, sizeof(struct netif) + LWIP_HOSTNAME_LEN); #else - netif = (struct netif*) rt_malloc (sizeof(struct netif)); + netif = (struct netif*) rt_calloc (1, sizeof(struct netif)); #endif if (netif == RT_NULL) { rt_kprintf("malloc netif failed\n"); return -RT_ERROR; } -#if LWIP_NETIF_HOSTNAME - rt_memset(netif, 0, sizeof(struct netif)+ LWIP_HOSTNAME_LEN); -#else - rt_memset(netif, 0, sizeof(struct netif)); -#endif /* set netif */ dev->netif = netif; |
