about summary refs log tree commit diff
path: root/Src/Modules/tcp.c
diff options
context:
space:
mode:
Diffstat (limited to 'Src/Modules/tcp.c')
-rw-r--r--Src/Modules/tcp.c6
1 files changed, 4 insertions, 2 deletions
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));
+    }
 }
 
 /**/