Hans Leidekker : wininet: Cleanup any existing cache file before creating a new one.

Alexandre Julliard julliard at winehq.org
Mon Dec 7 10:26:17 CST 2009


Module: wine
Branch: master
Commit: 4a22c88b3776e68ea8fc5b3c669be890b6e92204
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=4a22c88b3776e68ea8fc5b3c669be890b6e92204

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Mon Dec  7 09:18:00 2009 +0100

wininet: Cleanup any existing cache file before creating a new one.

Otherwise we leak the file name and handle when a request is sent again.
Found by Valgrind.

---

 dlls/wininet/http.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c
index 024d5d8..6123c5f 100644
--- a/dlls/wininet/http.c
+++ b/dlls/wininet/http.c
@@ -3638,6 +3638,9 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *lpwhr, LPCWSTR lpszHeaders,
 
         b = CreateUrlCacheEntryW(url, lpwhr->dwContentLength > 0 ? lpwhr->dwContentLength : 0, NULL, cacheFileName, 0);
         if(b) {
+            HeapFree(GetProcessHeap(), 0, lpwhr->lpszCacheFile);
+            CloseHandle(lpwhr->hCacheFile);
+
             lpwhr->lpszCacheFile = heap_strdupW(cacheFileName);
             lpwhr->hCacheFile = CreateFileW(lpwhr->lpszCacheFile, GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE,
                       NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);




More information about the wine-cvs mailing list