mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-30 18:02:05 +00:00
Merge pull request #2210 from wiffel/devel
Add SSLFree after SLShutdown to prevent memory leak
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user