Merge pull request #2210 from wiffel/devel

Add SSLFree after SLShutdown to prevent memory leak
This commit is contained in:
Dominik Picheta
2015-02-25 08:07:57 +00:00
2 changed files with 4 additions and 0 deletions

View File

@@ -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:

View File

@@ -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