Add SSLFree after SLShutdown to prevent memory leak
This commit is contained in:
parent
819a2a03ac
commit
72e4e7291f
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
|
# shutdown i.e not wait for the peers "close notify" alert with a second
|
||||||
# call to SSLShutdown
|
# call to SSLShutdown
|
||||||
let res = SSLShutdown(socket.sslHandle)
|
let res = SSLShutdown(socket.sslHandle)
|
||||||
|
SSLFree(socket.sslHandle)
|
||||||
|
socket.sslHandle = nil
|
||||||
if res == 0:
|
if res == 0:
|
||||||
discard
|
discard
|
||||||
elif res != 1:
|
elif res != 1:
|
||||||
|
|
|
||||||
|
|
@ -657,6 +657,8 @@ proc close*(socket: Socket) =
|
||||||
when defined(ssl):
|
when defined(ssl):
|
||||||
if socket.isSSL:
|
if socket.isSSL:
|
||||||
discard SSLShutdown(socket.sslHandle)
|
discard SSLShutdown(socket.sslHandle)
|
||||||
|
SSLFree(socket.sslHandle)
|
||||||
|
socket.sslHandle = nil
|
||||||
|
|
||||||
proc getServByName*(name, proto: string): Servent {.tags: [ReadIOEffect].} =
|
proc getServByName*(name, proto: string): Servent {.tags: [ReadIOEffect].} =
|
||||||
## Searches the database from the beginning and finds the first entry for
|
## Searches the database from the beginning and finds the first entry for
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue