md: clean OpenSSL memory when DLL is unloaded

This commit is contained in:
Frank Morgner 2018-11-06 00:09:35 +01:00
parent 027ccad439
commit 447335bc1f

View File

@ -48,6 +48,7 @@
#include "libopensc/log.h"
#include "libopensc/internal.h"
#include "libopensc/aux-data.h"
#include "libopensc/sc-ossl-compat.h"
#include "ui/notify.h"
#include "ui/strings.h"
#include "ui/wchar_from_char_str.h"
@ -60,6 +61,10 @@
#endif
#endif
#ifdef ENABLE_OPENPACE
#include <eac/eac.h>
#endif
#if defined(__MINGW32__)
#include "cardmod-mingw-compat.h"
#endif
@ -6999,9 +7004,14 @@ BOOL APIENTRY DllMain( HINSTANCE hinstDLL,
break;
case DLL_PROCESS_DETACH:
sc_notify_close();
if (lpReserved == NULL) {
#if defined(ENABLE_OPENSSL) && defined(OPENSSL_SECURE_MALLOC_SIZE)
CRYPTO_secure_malloc_done();
CRYPTO_secure_malloc_done();
#endif
#ifdef ENABLE_OPENPACE
EAC_cleanup();
#endif
}
break;
}
return TRUE;