You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a case where SSL_free is not called on p_ssl_handle_. If the connection was never made then Disconnect() is never called (due to is_connected_ check) and p_ssl_handle_ is never freed. The fix that worked for me was to change destructor like so:
OpenSSLConnection::~OpenSSLConnection() {
if (is_connected_) {
Disconnect();
}
else {
if (p_ssl_handle_) {
SSL_free(p_ssl_handle_); // this is new
}
}
SSL_CTX_free(p_ssl_context_);
#ifdef WIN32
WSACleanup();
#endif
}
There might also be another case if ConnectInternal() is called more then once before a Disconnect() is called. I can see this happening if there are reconnect attempts made externally. This can probably be fixed by just allocating p_ssl_handle_ once in ConnectInternal():
if (!p_ssl_handle_)
{
p_ssl_handle_ = SSL_new(p_ssl_context_);
}
The text was updated successfully, but these errors were encountered:
Hi @aaronovz1 ,
Thanks for pointing this out. We will make a fix for this and will push it to master once we are done with our internal testing.
Thanks!
Varun
And, for the same reason, the TCP socket won't be closed either if, for example, it's connected but then the SSL handshake fails - is_connected_ won't be set true in this case.
There is a case where
SSL_free
is not called onp_ssl_handle_
. If the connection was never made thenDisconnect()
is never called (due tois_connected_
check) andp_ssl_handle_
is never freed. The fix that worked for me was to change destructor like so:There might also be another case if
ConnectInternal()
is called more then once before aDisconnect()
is called. I can see this happening if there are reconnect attempts made externally. This can probably be fixed by just allocatingp_ssl_handle_
once inConnectInternal()
:The text was updated successfully, but these errors were encountered: