wininet: Free all cookie data in free_cookie.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2016-07-06 13:43:35 +02:00 committed by Alexandre Julliard
parent cf9cd32df3
commit 8332d80665
1 changed files with 32 additions and 1 deletions

View File

@ -684,6 +684,33 @@ DWORD get_cookie_header(const WCHAR *host, const WCHAR *path, WCHAR **ret)
return res;
}
static void free_cookie_domain_list(struct list *list)
{
cookie_container_t *container;
cookie_domain_t *domain;
while(!list_empty(list)) {
domain = LIST_ENTRY(list_next(list, list), cookie_domain_t, entry);
free_cookie_domain_list(&domain->subdomain_list);
while(!list_empty(&domain->path_list)) {
container = LIST_ENTRY(list_next(&domain->path_list, &domain->path_list), cookie_container_t, entry);
while(!list_empty(&container->cookie_list))
delete_cookie(LIST_ENTRY(list_next(&container->cookie_list, &container->cookie_list), cookie_t, entry));
heap_free(container->cookie_url);
list_remove(&container->entry);
heap_free(container);
}
heap_free(domain->domain);
list_remove(&domain->entry);
heap_free(domain);
}
}
/***********************************************************************
* InternetGetCookieExW (WININET.@)
*
@ -1239,5 +1266,9 @@ BOOL WINAPI InternetSetPerSiteCookieDecisionW( LPCWSTR pchHostName, DWORD dwDeci
void free_cookie(void)
{
DeleteCriticalSection(&cookie_cs);
EnterCriticalSection(&cookie_cs);
free_cookie_domain_list(&domain_list);
LeaveCriticalSection(&cookie_cs);
}