Fixed variable initialisation and cleanup.

This commit is contained in:
Armin Novak 2015-01-20 12:31:37 +01:00
parent cadd2675f6
commit 97988b4868

View File

@ -659,8 +659,8 @@ static void encomsp_process_connect(encomspPlugin* encomsp)
/****************************************************************************************/
static wListDictionary* g_InitHandles;
static wListDictionary* g_OpenHandles;
static wListDictionary* g_InitHandles = NULL;
static wListDictionary* g_OpenHandles = NULL;
void encomsp_add_init_handle_data(void* pInitHandle, void* pUserData)
{
@ -680,6 +680,11 @@ void* encomsp_get_init_handle_data(void* pInitHandle)
void encomsp_remove_init_handle_data(void* pInitHandle)
{
ListDictionary_Remove(g_InitHandles, pInitHandle);
if (ListDictionary_Count(g_InitHandles) < 1)
{
ListDictionary_Free(g_InitHandles);
g_InitHandles = NULL;
}
}
void encomsp_add_open_handle_data(DWORD openHandle, void* pUserData)
@ -704,6 +709,11 @@ void encomsp_remove_open_handle_data(DWORD openHandle)
{
void* pOpenHandle = (void*) (size_t) openHandle;
ListDictionary_Remove(g_OpenHandles, pOpenHandle);
if (ListDictionary_Count(g_OpenHandles) < 1)
{
ListDictionary_Free(g_OpenHandles);
g_OpenHandles = NULL;
}
}
int encomsp_send(encomspPlugin* encomsp, wStream* s)