Commit b36cb0b9 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

urlmon: Clean session related data in free_session function.

parent e804d091
...@@ -119,7 +119,7 @@ static HRESULT get_protocol_cf(LPCWSTR schema, DWORD schema_len, CLSID *pclsid, ...@@ -119,7 +119,7 @@ static HRESULT get_protocol_cf(LPCWSTR schema, DWORD schema_len, CLSID *pclsid,
return SUCCEEDED(hres) ? S_OK : MK_E_SYNTAX; 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; name_space *new_name_space;
...@@ -165,15 +165,6 @@ static HRESULT unregister_namespace(IClassFactory *cf, LPCWSTR protocol) ...@@ -165,15 +165,6 @@ static HRESULT unregister_namespace(IClassFactory *cf, LPCWSTR protocol)
return S_OK; 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) BOOL is_registered_protocol(LPCWSTR url)
{ {
DWORD schema_len; DWORD schema_len;
...@@ -675,5 +666,21 @@ HRESULT WINAPI ObtainUserAgentString(DWORD dwOption, LPSTR pcszUAOut, DWORD *cbS ...@@ -675,5 +666,21 @@ HRESULT WINAPI ObtainUserAgentString(DWORD dwOption, LPSTR pcszUAOut, DWORD *cbS
void free_session(void) 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); heap_free(user_agent);
} }
...@@ -42,7 +42,7 @@ LONG URLMON_refCount = 0; ...@@ -42,7 +42,7 @@ LONG URLMON_refCount = 0;
static HMODULE hCabinet = NULL; static HMODULE hCabinet = NULL;
static DWORD urlmon_tls = TLS_OUT_OF_INDEXES; 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); static struct list tls_list = LIST_INIT(tls_list);
...@@ -136,7 +136,6 @@ static void process_detach(void) ...@@ -136,7 +136,6 @@ static void process_detach(void)
if (hCabinet) if (hCabinet)
FreeLibrary(hCabinet); FreeLibrary(hCabinet);
init_session(FALSE);
free_session(); free_session();
free_tls_list(); free_tls_list();
} }
...@@ -152,7 +151,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad) ...@@ -152,7 +151,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
switch(fdwReason) { switch(fdwReason) {
case DLL_PROCESS_ATTACH: case DLL_PROCESS_ATTACH:
init_session(TRUE); init_session();
break; break;
case DLL_PROCESS_DETACH: case DLL_PROCESS_DETACH:
...@@ -327,15 +326,14 @@ static const struct object_creation_info object_creation[] = ...@@ -327,15 +326,14 @@ static const struct object_creation_info object_creation[] =
{ &CLSID_CUri, &CUriCF.IClassFactory_iface, NULL } { &CLSID_CUri, &CUriCF.IClassFactory_iface, NULL }
}; };
static void init_session(BOOL init) static void init_session(void)
{ {
unsigned int i; unsigned int i;
for(i=0; i < sizeof(object_creation)/sizeof(object_creation[0]); i++) { for(i=0; i < sizeof(object_creation)/sizeof(object_creation[0]); i++) {
if(object_creation[i].protocol) if(object_creation[i].protocol)
register_urlmon_namespace(object_creation[i].cf, object_creation[i].clsid, register_namespace(object_creation[i].cf, object_creation[i].clsid,
object_creation[i].protocol, init); object_creation[i].protocol, TRUE);
} }
} }
......
...@@ -68,7 +68,7 @@ IInternetProtocolInfo *get_protocol_info(LPCWSTR) DECLSPEC_HIDDEN; ...@@ -68,7 +68,7 @@ IInternetProtocolInfo *get_protocol_info(LPCWSTR) DECLSPEC_HIDDEN;
HRESULT get_protocol_handler(IUri*,CLSID*,BOOL*,IClassFactory**) DECLSPEC_HIDDEN; HRESULT get_protocol_handler(IUri*,CLSID*,BOOL*,IClassFactory**) DECLSPEC_HIDDEN;
IInternetProtocol *get_mime_filter(LPCWSTR) DECLSPEC_HIDDEN; IInternetProtocol *get_mime_filter(LPCWSTR) DECLSPEC_HIDDEN;
BOOL is_registered_protocol(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; HINTERNET get_internet_session(IInternetBindInfo*) DECLSPEC_HIDDEN;
LPWSTR get_useragent(void) DECLSPEC_HIDDEN; LPWSTR get_useragent(void) DECLSPEC_HIDDEN;
void free_session(void) DECLSPEC_HIDDEN; void free_session(void) DECLSPEC_HIDDEN;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment