mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-01-14 18:36:27 +00:00
icmp: Fix memory leak in icmp_input() error paths
Ensure the newly allocated packet buffer is freed in error paths. Signed-off-by: Axel Lin <axel.lin@ingics.com>
This commit is contained in:
parent
3b60c855e1
commit
7f92660598
@ -164,11 +164,13 @@ icmp_input(struct pbuf *p, struct netif *inp)
|
||||
/* switch r->payload back to icmp header */
|
||||
if (pbuf_header(r, -hlen)) {
|
||||
LWIP_ASSERT("icmp_input: moving r->payload to icmp header failed\n", 0);
|
||||
pbuf_free(r);
|
||||
goto icmperr;
|
||||
}
|
||||
/* copy the rest of the packet without ip header */
|
||||
if (pbuf_copy(r, p) != ERR_OK) {
|
||||
LWIP_ASSERT("icmp_input: copying to new pbuf failed\n", 0);
|
||||
pbuf_free(r);
|
||||
goto icmperr;
|
||||
}
|
||||
/* free the original p */
|
||||
|
Loading…
Reference in New Issue
Block a user