Free ALLOC_CACHE_HANDLER on dll unload (#1253)

This commit is contained in:
Justin Kotalik 2018-08-17 14:26:53 -07:00 committed by GitHub
parent 24ed5586dc
commit 5fc59b2331
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 5 deletions

View File

@ -75,6 +75,8 @@ BOOL APIENTRY DllMain(HMODULE hModule,
break;
case DLL_PROCESS_DETACH:
g_fProcessDetach = TRUE;
IN_PROCESS_HANDLER::StaticTerminate();
ALLOC_CACHE_HANDLER::StaticTerminate();
DebugStop();
default:
break;

View File

@ -180,11 +180,18 @@ HRESULT
Finished:
if (FAILED(hr))
{
if (sm_pAlloc != NULL)
{
delete sm_pAlloc;
sm_pAlloc = NULL;
}
StaticTerminate();
}
return hr;
}
// static
void
IN_PROCESS_HANDLER::StaticTerminate(VOID)
{
if (sm_pAlloc != NULL)
{
delete sm_pAlloc;
sm_pAlloc = NULL;
}
}

View File

@ -70,6 +70,10 @@ public:
HRESULT
StaticInitialize(VOID);
static
void
StaticTerminate(VOID);
private:
REQUEST_NOTIFICATION_STATUS
ServerShutdownMessage() const;

View File

@ -260,6 +260,8 @@ BOOL APIENTRY DllMain(HMODULE hModule,
break;
case DLL_PROCESS_DETACH:
g_fProcessDetach = TRUE;
FORWARDING_HANDLER::StaticTerminate();
ALLOC_CACHE_HANDLER::StaticTerminate();
DebugStop();
default:
break;