Rob Shearman : wininet: Fix memory leak in HTTP_DeleteCustomHeader.

Alexandre Julliard julliard at winehq.org
Sat Jun 21 05:38:36 CDT 2008


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

Author: Rob Shearman <robertshearman at gmail.com>
Date:   Fri Jun 20 10:14:38 2008 +0100

wininet: Fix memory leak in HTTP_DeleteCustomHeader.

Free the memory associated with the field and value of the custom
header otherwise it will be leaked. 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 79e3511..10fa8a5 100644
--- a/dlls/wininet/http.c
+++ b/dlls/wininet/http.c
@@ -4141,6 +4141,9 @@ static BOOL HTTP_DeleteCustomHeader(LPWININETHTTPREQW lpwhr, DWORD index)
         return FALSE;
     lpwhr->nCustHeaders--;
 
+    HeapFree(GetProcessHeap(), 0, lpwhr->pCustHeaders[index].lpszField);
+    HeapFree(GetProcessHeap(), 0, lpwhr->pCustHeaders[index].lpszValue);
+
     memmove( &lpwhr->pCustHeaders[index], &lpwhr->pCustHeaders[index+1],
              (lpwhr->nCustHeaders - index)* sizeof(HTTPHEADERW) );
     memset( &lpwhr->pCustHeaders[lpwhr->nCustHeaders], 0, sizeof(HTTPHEADERW) );




More information about the wine-cvs mailing list