From 7d5bcec92d3a756987f3ee22e88aa45760d31bbd Mon Sep 17 00:00:00 2001
From: Sergey Lyubka <valenok@gmail.com>
Date: Wed, 15 May 2013 08:28:56 +0100
Subject: [PATCH] Better cleanup in close_connection()

---
 mongoose.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/mongoose.c b/mongoose.c
index def91b018..9e88fabda 100644
--- a/mongoose.c
+++ b/mongoose.c
@@ -4888,11 +4888,13 @@ static void close_connection(struct mg_connection *conn) {
   conn->must_close = 1;
   if (conn->client.sock != INVALID_SOCKET) {
     close_socket_gracefully(conn);
+    conn->client.sock = INVALID_SOCKET;
   }
 #ifndef NO_SSL
   // Must be done AFTER socket is closed
   if (conn->ssl != NULL) {
     SSL_free(conn->ssl);
+    conn->ssl = NULL;
   }
 #endif
 }
-- 
GitLab