Only free the queued packets if there are any.

This commit is contained in:
likewise 2003-06-09 20:28:10 +00:00
parent b306cab8be
commit 734400cafa

View File

@ -158,20 +158,24 @@ etharp_tmr(void)
DEBUGF(ETHARP_DEBUG, ("etharp_timer: expired stable entry %u.\n", i));
arp_table[i].state = ETHARP_STATE_EMPTY;
#if ARP_QUEUEING
/* remove any queued packet */
pbuf_free(arp_table[i].p);
arp_table[i].p = NULL;
if (arp_table[i].p != NULL) {
/* remove any queued packet */
DEBUGF(ETHARP_DEBUG, ("etharp_timer: freeing packet queue %p.\n", i, (void *)(arp_table[i].p)));
pbuf_free(arp_table[i].p);
arp_table[i].p = NULL;
}
#endif
} else if ((arp_table[i].state == ETHARP_STATE_PENDING) &&
(arp_table[i].ctime >= ARP_MAXPENDING)) {
arp_table[i].state = ETHARP_STATE_EMPTY;
#if ARP_QUEUEING
DEBUGF(ETHARP_DEBUG, ("etharp_timer: expired pending entry %u - dequeueing %p.\n", i, (void *)(arp_table[i].p)));
/* remove any queued packet */
pbuf_free(arp_table[i].p);
arp_table[i].p = NULL;
#else
DEBUGF(ETHARP_DEBUG, ("etharp_timer: expired pending entry %u.\n", i));
#if ARP_QUEUEING
if (arp_table[i].p != NULL) {
/* remove any queued packet */
DEBUGF(ETHARP_DEBUG, ("etharp_timer: freeing packet queue %p.\n", i, (void *)(arp_table[i].p)));
pbuf_free(arp_table[i].p);
arp_table[i].p = NULL;
}
#endif
}
}