mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-11-05 08:28:32 +00:00
Added pbuf_alloc() return value checks in ip_frag().
This commit is contained in:
parent
11a820458f
commit
61dc2e7dd5
@ -17,6 +17,10 @@ FUTURE
|
|||||||
|
|
||||||
HISTORY
|
HISTORY
|
||||||
|
|
||||||
|
2006-03-03 Christiaan Simons
|
||||||
|
* ipv4/ip_frag.c: Added bound-checking assertions on ip_reassbitmap
|
||||||
|
access and added pbuf_alloc() return value checks.
|
||||||
|
|
||||||
2006-01-01 Leon Woestenberg <leon.woestenberg@gmx.net>
|
2006-01-01 Leon Woestenberg <leon.woestenberg@gmx.net>
|
||||||
* tcp_{in,out}.c, tcp_out.c: Removed 'even sndbuf' fix in TCP, which is
|
* tcp_{in,out}.c, tcp_out.c: Removed 'even sndbuf' fix in TCP, which is
|
||||||
now handled by the checksum routine properly.
|
now handled by the checksum routine properly.
|
||||||
|
@ -304,6 +304,9 @@ ip_frag(struct pbuf *p, struct netif *netif, struct ip_addr *dest)
|
|||||||
|
|
||||||
/* Get a RAM based MTU sized pbuf */
|
/* Get a RAM based MTU sized pbuf */
|
||||||
rambuf = pbuf_alloc(PBUF_LINK, 0, PBUF_REF);
|
rambuf = pbuf_alloc(PBUF_LINK, 0, PBUF_REF);
|
||||||
|
if (rambuf == NULL) {
|
||||||
|
return ERR_MEM;
|
||||||
|
}
|
||||||
rambuf->tot_len = rambuf->len = mtu;
|
rambuf->tot_len = rambuf->len = mtu;
|
||||||
rambuf->payload = MEM_ALIGN((void *)buf);
|
rambuf->payload = MEM_ALIGN((void *)buf);
|
||||||
|
|
||||||
@ -347,11 +350,15 @@ ip_frag(struct pbuf *p, struct netif *netif, struct ip_addr *dest)
|
|||||||
* worked would make things simpler.
|
* worked would make things simpler.
|
||||||
*/
|
*/
|
||||||
header = pbuf_alloc(PBUF_LINK, 0, PBUF_RAM);
|
header = pbuf_alloc(PBUF_LINK, 0, PBUF_RAM);
|
||||||
pbuf_chain(header, rambuf);
|
if (header != NULL) {
|
||||||
netif->output(netif, header, dest);
|
pbuf_chain(header, rambuf);
|
||||||
IPFRAG_STATS_INC(ip_frag.xmit);
|
netif->output(netif, header, dest);
|
||||||
pbuf_free(header);
|
IPFRAG_STATS_INC(ip_frag.xmit);
|
||||||
|
pbuf_free(header);
|
||||||
|
} else {
|
||||||
|
pbuf_free(rambuf);
|
||||||
|
return ERR_MEM;
|
||||||
|
}
|
||||||
left -= cop;
|
left -= cop;
|
||||||
}
|
}
|
||||||
pbuf_free(rambuf);
|
pbuf_free(rambuf);
|
||||||
|
Loading…
Reference in New Issue
Block a user