diff --git a/lib/pure/net.nim b/lib/pure/net.nim index 5e5c4f8ec6..bed7515420 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 8ac5d4f091..3afb545c8d 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