Merge pull request #2210 from wiffel/devel
Add SSLFree after SLShutdown to prevent memory leak
This commit is contained in:
commit
dc8b07fe0b
2 changed files with 4 additions and 0 deletions
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue