urlmon: Clean session related data in free_session function.

This commit is contained in:
Piotr Caban 2012-03-13 14:09:30 +01:00 committed by Alexandre Julliard
parent e804d0915a
commit b36cb0b94d
3 changed files with 23 additions and 18 deletions

View File

@ -119,7 +119,7 @@ static HRESULT get_protocol_cf(LPCWSTR schema, DWORD schema_len, CLSID *pclsid,
return SUCCEEDED(hres) ? S_OK : MK_E_SYNTAX;
}
static HRESULT register_namespace(IClassFactory *cf, REFIID clsid, LPCWSTR protocol, BOOL urlmon_protocol)
HRESULT register_namespace(IClassFactory *cf, REFIID clsid, LPCWSTR protocol, BOOL urlmon_protocol)
{
name_space *new_name_space;
@ -165,15 +165,6 @@ static HRESULT unregister_namespace(IClassFactory *cf, LPCWSTR protocol)
return S_OK;
}
void register_urlmon_namespace(IClassFactory *cf, REFIID clsid, LPCWSTR protocol, BOOL do_register)
{
if(do_register)
register_namespace(cf, clsid, protocol, TRUE);
else
unregister_namespace(cf, protocol);
}
BOOL is_registered_protocol(LPCWSTR url)
{
DWORD schema_len;
@ -675,5 +666,21 @@ HRESULT WINAPI ObtainUserAgentString(DWORD dwOption, LPSTR pcszUAOut, DWORD *cbS
void free_session(void)
{
name_space *ns_iter, *ns_last;
mime_filter *mf_iter, *mf_last;
LIST_FOR_EACH_ENTRY_SAFE(ns_iter, ns_last, &name_space_list, name_space, entry) {
if(!ns_iter->urlmon)
IClassFactory_Release(ns_iter->cf);
heap_free(ns_iter->protocol);
heap_free(ns_iter);
}
LIST_FOR_EACH_ENTRY_SAFE(mf_iter, mf_last, &mime_filter_list, mime_filter, entry) {
IClassFactory_Release(mf_iter->cf);
heap_free(mf_iter->mime);
heap_free(mf_iter);
}
heap_free(user_agent);
}

View File

@ -42,7 +42,7 @@ LONG URLMON_refCount = 0;
static HMODULE hCabinet = NULL;
static DWORD urlmon_tls = TLS_OUT_OF_INDEXES;
static void init_session(BOOL);
static void init_session(void);
static struct list tls_list = LIST_INIT(tls_list);
@ -136,7 +136,6 @@ static void process_detach(void)
if (hCabinet)
FreeLibrary(hCabinet);
init_session(FALSE);
free_session();
free_tls_list();
}
@ -152,7 +151,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
switch(fdwReason) {
case DLL_PROCESS_ATTACH:
init_session(TRUE);
init_session();
break;
case DLL_PROCESS_DETACH:
@ -327,15 +326,14 @@ static const struct object_creation_info object_creation[] =
{ &CLSID_CUri, &CUriCF.IClassFactory_iface, NULL }
};
static void init_session(BOOL init)
static void init_session(void)
{
unsigned int i;
for(i=0; i < sizeof(object_creation)/sizeof(object_creation[0]); i++) {
if(object_creation[i].protocol)
register_urlmon_namespace(object_creation[i].cf, object_creation[i].clsid,
object_creation[i].protocol, init);
register_namespace(object_creation[i].cf, object_creation[i].clsid,
object_creation[i].protocol, TRUE);
}
}

View File

@ -68,7 +68,7 @@ IInternetProtocolInfo *get_protocol_info(LPCWSTR) DECLSPEC_HIDDEN;
HRESULT get_protocol_handler(IUri*,CLSID*,BOOL*,IClassFactory**) DECLSPEC_HIDDEN;
IInternetProtocol *get_mime_filter(LPCWSTR) DECLSPEC_HIDDEN;
BOOL is_registered_protocol(LPCWSTR) DECLSPEC_HIDDEN;
void register_urlmon_namespace(IClassFactory*,REFIID,LPCWSTR,BOOL) DECLSPEC_HIDDEN;
HRESULT register_namespace(IClassFactory*,REFIID,LPCWSTR,BOOL) DECLSPEC_HIDDEN;
HINTERNET get_internet_session(IInternetBindInfo*) DECLSPEC_HIDDEN;
LPWSTR get_useragent(void) DECLSPEC_HIDDEN;
void free_session(void) DECLSPEC_HIDDEN;