From 36e3d24331069245773dcfcd1cfe8565fba6898f Mon Sep 17 00:00:00 2001 From: goldsimon Date: Mon, 27 Apr 2009 19:00:23 +0000 Subject: [PATCH] Fixed a bug in tcp_enqueue introduced with v1.79 of this file while fixing bug #25094 (zero-length pbuf) --- src/core/tcp_out.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c index be53c55d..5ecfe2fd 100644 --- a/src/core/tcp_out.c +++ b/src/core/tcp_out.c @@ -358,6 +358,8 @@ tcp_enqueue(struct tcp_pcb *pcb, void *arg, u16_t len, /* free the first (header-only) pbuf if it is now empty (contained only headers) */ struct pbuf *old_q = queue->p; queue->p = queue->p->next; + old_q->next = NULL; + queuelen--; pbuf_free(old_q); } LWIP_ASSERT("zero-length pbuf", (queue->p != NULL) && (queue->p->len > 0)); @@ -476,8 +478,8 @@ tcp_output(struct tcp_pcb *pcb) useg = pcb->unacked; if (useg != NULL) { for (; useg->next != NULL; useg = useg->next); - } - + } + /* If the TF_ACK_NOW flag is set and no data will be sent (either * because the ->unsent queue is empty or because the window does * not allow it), construct an empty ACK segment and send it.