Hans Leidekker : winhttp: Fix two memory leaks.
Alexandre Julliard
julliard at winehq.org
Wed Oct 21 13:14:11 CDT 2009
Module: wine
Branch: master
Commit: ec0a0b372ef7e30b2a52ec09754c7d238ae90de7
URL: http://source.winehq.org/git/wine.git/?a=commit;h=ec0a0b372ef7e30b2a52ec09754c7d238ae90de7
Author: Hans Leidekker <hans at codeweavers.com>
Date: Wed Oct 21 13:19:42 2009 +0200
winhttp: Fix two memory leaks.
Found by valgrind.
---
dlls/winhttp/cookie.c | 13 +++++--------
1 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/dlls/winhttp/cookie.c b/dlls/winhttp/cookie.c
index 6c0f8b4..af881ea 100644
--- a/dlls/winhttp/cookie.c
+++ b/dlls/winhttp/cookie.c
@@ -39,7 +39,7 @@ static domain_t *add_domain( session_t *session, WCHAR *name )
list_init( &domain->entry );
list_init( &domain->cookies );
- domain->name = name;
+ domain->name = strdupW( name );
list_add_tail( &session->cookie_cache, &domain->entry );
TRACE("%s\n", debugstr_w(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 );
- cookie->path = path;
+ cookie->path = strdupW( path );
list_add_tail( &domain->cookies, &cookie->entry );
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 )
ret = add_cookie( session, cookie, cookie_domain, cookie_path );
end:
- if (!ret)
- {
- free_cookie( cookie );
- heap_free( cookie_domain );
- heap_free( cookie_path );
- }
+ if (!ret) free_cookie( cookie );
+ heap_free( cookie_domain );
+ heap_free( cookie_path );
heap_free( buffer );
return ret;
}
More information about the wine-cvs
mailing list