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.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/Src/Modules/tcp.c b/Src/Modules/tcp.c
index 1fe813e3f..9109ca7c1 100644
--- a/Src/Modules/tcp.c
+++ b/Src/Modules/tcp.c
@@ -291,19 +291,21 @@ tcp_close(Tcp_session sess)
 {
     int err;
     
-    if (sess && sess->fd != -1)
+    if (sess)
     {  
-	err = close(sess->fd);
-	if (err)
+	if (sess->fd != -1)
 	{
-	    zwarn("connection close failed: %e", NULL, errno);
-	    return -1;
+	    err = close(sess->fd);
+	    if (err)
+	    {
+		zwarn("connection close failed: %e", NULL, errno);
+		return -1;
+	    }
 	}
 	zts_delete(sess);
 	return 0;
     }
 
-    zts_delete(sess);
     return -1;
 }