File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
Release/src/websockets/client Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change 6262
6363#endif /* __GNUC__ */
6464
65+ // This is a hack to avoid memory leak reports from the debug MSVC CRT for all
66+ // programs using the library: ASIO calls SSL_library_init() which calls
67+ // SSL_COMP_get_compression_methods(), which allocates some heap memory and the
68+ // only way to free it later is to call SSL_COMP_free_compression_methods(),
69+ // but this function is unaccessible from the application code as OpenSSL is
70+ // statically linked into the C++ REST SDK DLL. So, just to be nice, call it
71+ // here ourselves -- even if the real problem is in ASIO (up to v1.60.0).
72+ #if defined(_WIN32) && !defined(NDEBUG)
73+
74+ #include < openssl/ssl.h>
75+ static struct ASIO_SSL_memory_leak_suppress
76+ {
77+ ~ASIO_SSL_memory_leak_suppress ()
78+ {
79+ ::SSL_COMP_free_compression_methods ();
80+ }
81+ } ASIO_SSL_memory_leak_suppressor;
82+
83+ #endif /* _WIN32 && !NDEBUG */
84+
6585using websocketpp::lib::placeholders::_1;
6686using websocketpp::lib::placeholders::_2;
6787using websocketpp::lib::bind;
You can’t perform that action at this time.
0 commit comments