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.
This commit is contained in:
Rob Shearman 2008-06-20 10:14:38 +01:00 committed by Alexandre Julliard
parent 24ec4a6ed7
commit 62e0a8ca38
1 changed files with 3 additions and 0 deletions

View File

@ -4141,6 +4141,9 @@ static BOOL HTTP_DeleteCustomHeader(LPWININETHTTPREQW lpwhr, DWORD index)
return FALSE; return FALSE;
lpwhr->nCustHeaders--; lpwhr->nCustHeaders--;
HeapFree(GetProcessHeap(), 0, lpwhr->pCustHeaders[index].lpszField);
HeapFree(GetProcessHeap(), 0, lpwhr->pCustHeaders[index].lpszValue);
memmove( &lpwhr->pCustHeaders[index], &lpwhr->pCustHeaders[index+1], memmove( &lpwhr->pCustHeaders[index], &lpwhr->pCustHeaders[index+1],
(lpwhr->nCustHeaders - index)* sizeof(HTTPHEADERW) ); (lpwhr->nCustHeaders - index)* sizeof(HTTPHEADERW) );
memset( &lpwhr->pCustHeaders[lpwhr->nCustHeaders], 0, sizeof(HTTPHEADERW) ); memset( &lpwhr->pCustHeaders[lpwhr->nCustHeaders], 0, sizeof(HTTPHEADERW) );