Commit 62e0a8ca authored by Rob Shearman's avatar Rob Shearman Committed by Alexandre Julliard

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.
parent 24ec4a6e
...@@ -4141,6 +4141,9 @@ static BOOL HTTP_DeleteCustomHeader(LPWININETHTTPREQW lpwhr, DWORD index) ...@@ -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) );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment