diff --git a/src/api/netbuf.c b/src/api/netbuf.c index 50625167..8d2cd1b7 100644 --- a/src/api/netbuf.c +++ b/src/api/netbuf.c @@ -66,23 +66,9 @@ netbuf *netbuf_new(void) buf = (struct netbuf *)memp_malloc(MEMP_NETBUF); if (buf != NULL) { - buf->p = NULL; - buf->ptr = NULL; - ip_addr_set_zero(&buf->addr); - buf->port = 0; -#if LWIP_NETBUF_RECVINFO || LWIP_CHECKSUM_ON_COPY -#if LWIP_CHECKSUM_ON_COPY - buf->flags = 0; -#endif /* LWIP_CHECKSUM_ON_COPY */ - buf->toport_chksum = 0; -#if LWIP_NETBUF_RECVINFO - ip_addr_set_zero(&buf->toaddr); -#endif /* LWIP_NETBUF_RECVINFO */ -#endif /* LWIP_NETBUF_RECVINFO || LWIP_CHECKSUM_ON_COPY */ - return buf; - } else { - return NULL; + memset(buf, 0, sizeof(struct netbuf)); } + return buf; } /**