Check UDP pbuf for being NULL

cesanta/mongoose-os#186

PUBLISHED_FROM=30460b56211eb0dff4d05bff45f256ac1da2caf4
This commit is contained in:
Deomid Ryabkov authored and Cesanta Bot committed 2017-02-10 02:35:08 +00:00
1 parent fc113d64f5
commit f20b5191f2
1 file changed
+4
+4
View File
@@ -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));