about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--Src/Modules/tcp.c6
2 files changed, 7 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 56d97b3b2..4f36c5013 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2002-05-08  Peter Stephenson  <pws@csr.com>
 
+	* 17097: Src/Modules/tcp.c: closing all TCP sessions referenced
+	freed memory.
+
 	* Unposted: Src/Modules/zselect.c: remove an unused counter.
 
 	* 17095: Src/Modules/zselect.c: wrong index when appending to a
diff --git a/Src/Modules/tcp.c b/Src/Modules/tcp.c
index 5f5f432c6..e00e220b5 100644
--- a/Src/Modules/tcp.c
+++ b/Src/Modules/tcp.c
@@ -279,10 +279,12 @@ zts_byfd(int fd)
 static void
 tcp_cleanup(void)
 {
-    LinkNode node;
+    LinkNode node, next;
 
-    for (node = firstnode(ztcp_sessions); node; incnode(node))
+    for (node = firstnode(ztcp_sessions); node; node = next) {
+	next = node->next;
 	tcp_close((Tcp_session)getdata(node));
+    }
 }
 
 /**/