diff options
author | Attila Molnar <attilamolnar@hush.com> | 2015-11-10 17:25:02 +0100 |
---|---|---|
committer | Attila Molnar <attilamolnar@hush.com> | 2015-11-10 17:25:02 +0100 |
commit | b90f3aca13fd89053b9a9b41276734afab91588e (patch) | |
tree | ef2e0dea1933b2dcdb2fe46faa4c70d2cc587367 /src/modules | |
parent | 903a0075d3c123b16128b9f8f2eb36878c28e282 (diff) |
m_ssl_openssl Add workaround for a memory leak in OpenSSL
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/extra/m_ssl_openssl.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp index 7dd834e13..73a94ba36 100644 --- a/src/modules/extra/m_ssl_openssl.cpp +++ b/src/modules/extra/m_ssl_openssl.cpp @@ -363,6 +363,14 @@ namespace OpenSSL return 1; } + static int destroy(BIO* bio) + { + // XXX: Dummy function to avoid a memory leak in OpenSSL. + // The memory leak happens in BIO_free() (bio_lib.c) when the destroy func of the BIO is NULL. + // This is fixed in OpenSSL but some distros still ship the unpatched version hence we provide this workaround. + return 1; + } + static long ctrl(BIO* bio, int cmd, long num, void* ptr) { if (cmd == BIO_CTRL_FLUSH) @@ -385,7 +393,7 @@ static BIO_METHOD biomethods = NULL, // gets OpenSSL::BIOMethod::ctrl, OpenSSL::BIOMethod::create, - NULL, // destroy, NULL causes older OpenSSL to leak memory in BIO_free() (bio_lib.c) + OpenSSL::BIOMethod::destroy, // destroy, does nothing, see function body for more info NULL // callback_ctrl }; |