mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-01-30 12:32:37 +00:00
Fix bug #19729: free pbuf if netif->input() returns != ERR_OK.
This commit is contained in:
parent
2740a81103
commit
5c89228878
@ -158,6 +158,10 @@ HISTORY
|
|||||||
|
|
||||||
++ Bug fixes:
|
++ Bug fixes:
|
||||||
|
|
||||||
|
2007-05-16 Simon Goldschmidt
|
||||||
|
* loopif.c, slipif.c: Fix bug #19729: free pbuf if netif->input() returns
|
||||||
|
!= ERR_OK.
|
||||||
|
|
||||||
2007-05-16 Simon Goldschmidt
|
2007-05-16 Simon Goldschmidt
|
||||||
* api_msg.c, udp.c: If a udp_pcb has a local_ip set, check if it is the same
|
* api_msg.c, udp.c: If a udp_pcb has a local_ip set, check if it is the same
|
||||||
as the one of the netif used for sending to prevent sending from old
|
as the one of the netif used for sending to prevent sending from old
|
||||||
|
@ -61,6 +61,11 @@ loopif_poll(struct netif *netif)
|
|||||||
struct pbuf *in = NULL;
|
struct pbuf *in = NULL;
|
||||||
struct loopif_private *priv = (struct loopif_private*)netif->state;
|
struct loopif_private *priv = (struct loopif_private*)netif->state;
|
||||||
|
|
||||||
|
LWIP_ASSERT("priv != NULL", priv != NULL);
|
||||||
|
if(priv == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
/* Get a packet from the list. With SYS_LIGHTWEIGHT_PROT=1, this is protected */
|
/* Get a packet from the list. With SYS_LIGHTWEIGHT_PROT=1, this is protected */
|
||||||
SYS_ARCH_PROTECT(lev);
|
SYS_ARCH_PROTECT(lev);
|
||||||
@ -82,10 +87,13 @@ loopif_poll(struct netif *netif)
|
|||||||
in->next = NULL;
|
in->next = NULL;
|
||||||
LWIP_ASSERT("packet must not consist of multiple pbufs!", in->len == in->tot_len);
|
LWIP_ASSERT("packet must not consist of multiple pbufs!", in->len == in->tot_len);
|
||||||
}
|
}
|
||||||
netif->input(in, netif);
|
if(netif->input(in, netif) != ERR_OK) {
|
||||||
|
pbuf_free(in);
|
||||||
|
in = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/* go on while there is a packet on the list */
|
/* go on while there is a packet on the list */
|
||||||
} while(in != NULL);
|
} while(priv->first != NULL);
|
||||||
}
|
}
|
||||||
#endif /* LWIP_LOOPIF_MULTITHREADING */
|
#endif /* LWIP_LOOPIF_MULTITHREADING */
|
||||||
|
|
||||||
@ -122,7 +130,10 @@ loopif_output(struct netif *netif, struct pbuf *p,
|
|||||||
/* Multithreading environment, netif->input() is supposed to put the packet
|
/* Multithreading environment, netif->input() is supposed to put the packet
|
||||||
into a mailbox, so we can safely call it here without risking to re-enter
|
into a mailbox, so we can safely call it here without risking to re-enter
|
||||||
functions that are not reentrant (TCP!!!) */
|
functions that are not reentrant (TCP!!!) */
|
||||||
netif->input(r, netif);
|
if(netif->input(r, netif) != ERR_OK) {
|
||||||
|
pbuf_free(r);
|
||||||
|
r = NULL;
|
||||||
|
}
|
||||||
#else /* LWIP_LOOPIF_MULTITHREADING */
|
#else /* LWIP_LOOPIF_MULTITHREADING */
|
||||||
/* Raw API without threads: put the packet on a linked list which gets emptied
|
/* Raw API without threads: put the packet on a linked list which gets emptied
|
||||||
through calling loopif_poll(). */
|
through calling loopif_poll(). */
|
||||||
|
@ -182,7 +182,10 @@ slipif_loop(void *nf)
|
|||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
p = slipif_input(netif);
|
p = slipif_input(netif);
|
||||||
netif->input(p, netif);
|
if(netif->input(p, netif) != ERR_OK) {
|
||||||
|
pbuf_free(p);
|
||||||
|
p = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user