summaryrefslogtreecommitdiff
path: root/plugins/OpenSSL
diff options
context:
space:
mode:
authorTobias Weimer <wishmaster51@googlemail.com>2015-01-09 16:38:44 +0000
committerTobias Weimer <wishmaster51@googlemail.com>2015-01-09 16:38:44 +0000
commit7fb5bb3e6f40021b22cb2063ece3394f72d31ac2 (patch)
tree7174e6071f706d249ad0f462033ce4f60f976eb5 /plugins/OpenSSL
parent8cabf8af42bfd0384742ec3a22fde4fa3992a2a4 (diff)
OpenSSL: Fixed memory leak
git-svn-id: http://svn.miranda-ng.org/main/trunk@11803 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/OpenSSL')
-rw-r--r--plugins/OpenSSL/src/ssl_openssl.cpp31
1 files changed, 16 insertions, 15 deletions
diff --git a/plugins/OpenSSL/src/ssl_openssl.cpp b/plugins/OpenSSL/src/ssl_openssl.cpp
index 78ed29bd69..4e910d24ea 100644
--- a/plugins/OpenSSL/src/ssl_openssl.cpp
+++ b/plugins/OpenSSL/src/ssl_openssl.cpp
@@ -480,28 +480,29 @@ cleanup:
SslHandle *NetlibSslConnect(SOCKET s, const char* host, int verify)
{
- SslHandle *ssl = (SslHandle*)mir_calloc(sizeof(SslHandle));
- ssl->s = s;
/* negotiate SSL session, verify cert, return NULL if failed */
-
- DWORD dwFlags = 0;
- if (!host || inet_addr(host) != INADDR_NONE)
- dwFlags |= 0x00001000;
-
bool res = SSL_library_load();
- if (!res) {
+ if (!res)
return NULL;
- }
+
+ SslHandle *ssl = (SslHandle*)mir_calloc(sizeof(SslHandle));
+ ssl->s = s;
+ res = ClientConnect(ssl, host);
- if (res) res = ClientConnect(ssl, host);
- if (res && verify) res = VerifyCertificate(ssl, host, dwFlags);
+ if (res && verify) {
+ DWORD dwFlags = 0;
+ if (!host || inet_addr(host) != INADDR_NONE)
+ dwFlags |= 0x00001000;
+ res = VerifyCertificate(ssl, host, dwFlags);
+ }
- if (!res)
- {
+ if(res) {
+ return ssl;
+ }
+ else {
NetlibSslFree(ssl);
- ssl = NULL;
+ return NULL;
}
- return ssl;
}
void NetlibSslShutdown(SslHandle *ssl)