From 62e0a8ca38a0ab9216b0f232811280918083f1d5 Mon Sep 17 00:00:00 2001 From: Rob Shearman Date: Fri, 20 Jun 2008 10:14:38 +0100 Subject: [PATCH] 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 file changed, 3 insertions(+) diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c index 79e35111eaa..10fa8a5997f 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) );