From 1d8b6343f640ce23f953cc1e1d38cdd57697e22d Mon Sep 17 00:00:00 2001 From: Art Yerkes Date: Tue, 19 Aug 2008 12:39:46 +0000 Subject: [PATCH] Fix a leak when doing an immediate reply to a small packet (could be PSH|ACK with < 50 bytes, ACK|FIN, RST or similar). svn path=/trunk/; revision=35449 --- reactos/lib/drivers/oskittcp/oskittcp/tcp_subr.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/reactos/lib/drivers/oskittcp/oskittcp/tcp_subr.c b/reactos/lib/drivers/oskittcp/oskittcp/tcp_subr.c index 4632b688ef1..e3557eea13e 100644 --- a/reactos/lib/drivers/oskittcp/oskittcp/tcp_subr.c +++ b/reactos/lib/drivers/oskittcp/oskittcp/tcp_subr.c @@ -163,6 +163,7 @@ tcp_respond(tp, ti, m, ack, seq, flags) tcp_seq ack, seq; int flags; { + struct mbuf *n; register int tlen; int win = 0; struct route *ro = 0; @@ -221,6 +222,18 @@ tcp_respond(tp, ti, m, ack, seq, flags) tcp_trace(TA_OUTPUT, 0, tp, ti, 0); #endif (void) ip_output(m, NULL, ro, 0, NULL); +#ifdef __REACTOS__ + /* We allocated m, so we are responsible for freeing it. If the mbuf + contains a pointer to an external datablock, we (or rather, m_copy) + didn't allocate it but pointed it to the data to send. So we have + to cheat a little bit and keep M_FREE from freeing the external + data block */ + while (NULL != m) { + m->m_flags &= ~M_EXT; + MFREE(m, n); + m = n; + } +#endif } /*