Commit ec0a0b37 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

winhttp: Fix two memory leaks.

Found by valgrind.
parent 45b6cf83
...@@ -39,7 +39,7 @@ static domain_t *add_domain( session_t *session, WCHAR *name ) ...@@ -39,7 +39,7 @@ static domain_t *add_domain( session_t *session, WCHAR *name )
list_init( &domain->entry ); list_init( &domain->entry );
list_init( &domain->cookies ); list_init( &domain->cookies );
domain->name = name; domain->name = strdupW( name );
list_add_tail( &session->cookie_cache, &domain->entry ); list_add_tail( &session->cookie_cache, &domain->entry );
TRACE("%s\n", debugstr_w(domain->name)); TRACE("%s\n", debugstr_w(domain->name));
...@@ -120,7 +120,7 @@ static BOOL add_cookie( session_t *session, cookie_t *cookie, WCHAR *domain_name ...@@ -120,7 +120,7 @@ static BOOL add_cookie( session_t *session, cookie_t *cookie, WCHAR *domain_name
} }
else if ((old_cookie = find_cookie( domain, path, cookie->name ))) delete_cookie( old_cookie ); else if ((old_cookie = find_cookie( domain, path, cookie->name ))) delete_cookie( old_cookie );
cookie->path = path; cookie->path = strdupW( path );
list_add_tail( &domain->cookies, &cookie->entry ); list_add_tail( &domain->cookies, &cookie->entry );
TRACE("domain %s path %s <- %s=%s\n", debugstr_w(domain_name), debugstr_w(cookie->path), TRACE("domain %s path %s <- %s=%s\n", debugstr_w(domain_name), debugstr_w(cookie->path),
...@@ -230,12 +230,9 @@ BOOL set_cookies( request_t *request, const WCHAR *cookies ) ...@@ -230,12 +230,9 @@ BOOL set_cookies( request_t *request, const WCHAR *cookies )
ret = add_cookie( session, cookie, cookie_domain, cookie_path ); ret = add_cookie( session, cookie, cookie_domain, cookie_path );
end: end:
if (!ret) if (!ret) free_cookie( cookie );
{
free_cookie( cookie );
heap_free( cookie_domain ); heap_free( cookie_domain );
heap_free( cookie_path ); heap_free( cookie_path );
}
heap_free( buffer ); heap_free( buffer );
return ret; return ret;
} }
......
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