Fixed bug: assert fired when MEMP_ARP_QUEUE was empty (which can happen any time). Now the packet simply isn't enqueued when out of memory.

This commit is contained in:
goldsimon 2007-11-10 17:41:46 +00:00
parent bfe24b138d
commit 21bbc9a81a
2 changed files with 24 additions and 14 deletions

View File

@ -460,6 +460,10 @@ HISTORY
++ Bug fixes:
2007-11-10 Simon Goldschmidt
* etharp.c: Fixed bug: assert fired when MEMP_ARP_QUEUE was empty (which can
happen any time). Now the packet simply isn't enqueued when out of memory.
2007-11-01 Simon Goldschmidt
* tcp.c, tcp_in.c: Fixed bug #21494: The send mss (pcb->mss) is set to 536 (or
TCP_MSS if that is smaller) as long as no MSS option is received from the

View File

@ -945,7 +945,7 @@ etharp_query(struct netif *netif, struct ip_addr *ipaddr, struct pbuf *q)
struct etharp_q_entry *new_entry;
/* allocate a new arp queue entry */
new_entry = memp_malloc(MEMP_ARP_QUEUE);
LWIP_ASSERT("newEntry != NULL", new_entry != NULL);
if (new_entry != NULL) {
new_entry->next = 0;
new_entry->p = p;
if(arp_table[i].q != NULL) {
@ -962,6 +962,12 @@ etharp_query(struct netif *netif, struct ip_addr *ipaddr, struct pbuf *q)
}
LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, ("etharp_query: queued packet %p on ARP entry %"S16_F"\n", (void *)q, (s16_t)i));
result = ERR_OK;
} else {
/* the pool MEMP_ARP_QUEUE is empty */
pbuf_free(p);
LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, ("etharp_query: could not queue a copy of PBUF_REF packet %p (out of memory)\n", (void *)q));
/* { result == ERR_MEM } through initialization */
}
} else {
LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, ("etharp_query: could not queue a copy of PBUF_REF packet %p (out of memory)\n", (void *)q));
/* { result == ERR_MEM } through initialization */