summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--lib/pure/net.nim2
-rw-r--r--lib/pure/sockets.nim2
2 files changed, 4 insertions, 0 deletions
diff --git a/lib/pure/net.nim b/lib/pure/net.nim
index 5e5c4f8ec..bed751542 100644
--- a/lib/pure/net.nim
+++ b/lib/pure/net.nim
@@ -454,6 +454,8 @@ proc close*(socket: Socket) =
         # shutdown i.e not wait for the peers "close notify" alert with a second
         # call to SSLShutdown
         let res = SSLShutdown(socket.sslHandle)
+        SSLFree(socket.sslHandle)
+        socket.sslHandle = nil
         if res == 0:
           discard
         elif res != 1:
diff --git a/lib/pure/sockets.nim b/lib/pure/sockets.nim
index 8ac5d4f09..3afb545c8 100644
--- a/lib/pure/sockets.nim
+++ b/lib/pure/sockets.nim
@@ -657,6 +657,8 @@ proc close*(socket: Socket) =
   when defined(ssl):
     if socket.isSSL:
       discard SSLShutdown(socket.sslHandle)
+      SSLFree(socket.sslHandle)
+      socket.sslHandle = nil
 
 proc getServByName*(name, proto: string): Servent {.tags: [ReadIOEffect].} =
   ## Searches the database from the beginning and finds the first entry for