Commit f20b5191 authored by Deomid Ryabkov's avatar Deomid Ryabkov Committed by Cesanta Bot

Check UDP pbuf for being NULL

cesanta/mongoose-os#186

PUBLISHED_FROM=30460b56211eb0dff4d05bff45f256ac1da2caf4
parent fc113d64
......@@ -14035,6 +14035,10 @@ void mg_lwip_if_udp_send(struct mg_connection *nc, const void *buf,
struct pbuf *p = pbuf_alloc(PBUF_TRANSPORT, len, PBUF_RAM);
ip_addr_t *ip = (ip_addr_t *) &nc->sa.sin.sin_addr.s_addr;
u16_t port = ntohs(nc->sa.sin.sin_port);
if (p == NULL) {
DBG(("OOM"));
return;
}
memcpy(p->payload, buf, len);
cs->err = udp_sendto(upcb, p, (ip_addr_t *) ip, port);
DBG(("%p udp_sendto = %d", nc, cs->err));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment