From 6c39b8a10cc60771cbd4e83a4412e63575d95dcd Mon Sep 17 00:00:00 2001 From: goldsimon Date: Mon, 14 May 2007 20:10:46 +0000 Subject: [PATCH] Found a little bug in ARP_QUEUEING: if pbuf_alloc for the packet to be queued failed, pbuf_copy was called with a NULL pointer. --- src/netif/etharp.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/netif/etharp.c b/src/netif/etharp.c index a04afc53..ceca0d5f 100644 --- a/src/netif/etharp.c +++ b/src/netif/etharp.c @@ -865,9 +865,11 @@ err_t etharp_query(struct netif *netif, struct ip_addr *ipaddr, struct pbuf *q) if(copy_needed) { /* copy the whole packet into new pbufs */ p = pbuf_alloc(PBUF_RAW, p->tot_len, PBUF_RAM); - if (pbuf_copy(p, q) != ERR_OK) { - pbuf_free(p); - p = NULL; + if(p != NULL) { + if (pbuf_copy(p, q) != ERR_OK) { + pbuf_free(p); + p = NULL; + } } } else { /* referencing the old pbuf is enough */