Hans Leidekker : wininet: Fix a memory leak.

Alexandre Julliard julliard at winehq.org
Tue Feb 23 11:17:25 CST 2010


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

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Tue Feb 23 13:03:37 2010 +0100

wininet: Fix a memory leak.

Found by Valgrind.

---

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

diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c
index 62c3953..ab7e1da 100644
--- a/dlls/wininet/http.c
+++ b/dlls/wininet/http.c
@@ -4431,7 +4431,7 @@ static INT HTTP_GetResponseHeaders(http_request_t *lpwhr, BOOL clear)
     char bufferA[MAX_REPLY_LEN];
     LPWSTR status_code = NULL, status_text = NULL;
     DWORD cchMaxRawHeaders = 1024;
-    LPWSTR lpszRawHeaders = HeapAlloc(GetProcessHeap(), 0, (cchMaxRawHeaders+1)*sizeof(WCHAR));
+    LPWSTR lpszRawHeaders = NULL;
     LPWSTR temp;
     DWORD cchRawHeaders = 0;
     BOOL codeHundred = FALSE;
@@ -4507,6 +4507,9 @@ static INT HTTP_GetResponseHeaders(http_request_t *lpwhr, BOOL clear)
     *(status_text-1) = ' ';
 
     /* regenerate raw headers */
+    lpszRawHeaders = HeapAlloc(GetProcessHeap(), 0, (cchMaxRawHeaders + 1) * sizeof(WCHAR));
+    if (!lpszRawHeaders) goto lend;
+
     while (cchRawHeaders + buflen + strlenW(szCrLf) > cchMaxRawHeaders)
         cchMaxRawHeaders *= 2;
     temp = HeapReAlloc(GetProcessHeap(), 0, lpszRawHeaders, (cchMaxRawHeaders+1)*sizeof(WCHAR));




More information about the wine-cvs mailing list