winhttp: Fix some valgrind warnings.

This commit is contained in:
Hans Leidekker 2011-07-29 13:25:04 +02:00 committed by Alexandre Julliard
parent 48ccf4f9f8
commit c54772c114
2 changed files with 4 additions and 2 deletions

View File

@ -2446,7 +2446,6 @@ static HRESULT WINAPI winhttp_request_Open(
debugstr_variant(&async)); debugstr_variant(&async));
if (!method || !url) return E_INVALIDARG; if (!method || !url) return E_INVALIDARG;
if (!(request->verb = strdupW( method ))) return E_OUTOFMEMORY;
memset( &uc, 0, sizeof(uc) ); memset( &uc, 0, sizeof(uc) );
uc.dwStructSize = sizeof(uc); uc.dwStructSize = sizeof(uc);
@ -2455,6 +2454,7 @@ static HRESULT WINAPI winhttp_request_Open(
uc.dwUrlPathLength = ~0u; uc.dwUrlPathLength = ~0u;
uc.dwExtraInfoLength = ~0u; uc.dwExtraInfoLength = ~0u;
if (!WinHttpCrackUrl( url, 0, 0, &uc )) return HRESULT_FROM_WIN32( get_last_error() ); if (!WinHttpCrackUrl( url, 0, 0, &uc )) return HRESULT_FROM_WIN32( get_last_error() );
if (!(request->verb = strdupW( method ))) return E_OUTOFMEMORY;
if (!(hostname = heap_alloc( (uc.dwHostNameLength + 1) * sizeof(WCHAR) ))) return E_OUTOFMEMORY; if (!(hostname = heap_alloc( (uc.dwHostNameLength + 1) * sizeof(WCHAR) ))) return E_OUTOFMEMORY;
memcpy( hostname, uc.lpszHostName, uc.dwHostNameLength * sizeof(WCHAR) ); memcpy( hostname, uc.lpszHostName, uc.dwHostNameLength * sizeof(WCHAR) );
@ -2541,7 +2541,7 @@ static HRESULT WINAPI winhttp_request_SetRequestHeader(
} }
len = strlenW( header ) + 4; len = strlenW( header ) + 4;
if (value) len += strlenW( value ); if (value) len += strlenW( value );
if (!(str = heap_alloc( len * sizeof(WCHAR) ))) return E_OUTOFMEMORY; if (!(str = heap_alloc( (len + 1) * sizeof(WCHAR) ))) return E_OUTOFMEMORY;
sprintfW( str, fmtW, header, value ? value : emptyW ); sprintfW( str, fmtW, header, value ? value : emptyW );
ret = WinHttpAddRequestHeaders( request->hrequest, str, len, WINHTTP_ADDREQ_FLAG_REPLACE ); ret = WinHttpAddRequestHeaders( request->hrequest, str, len, WINHTTP_ADDREQ_FLAG_REPLACE );
@ -2795,6 +2795,7 @@ static DWORD request_read_body( struct winhttp_request *request, DWORD timeout )
request->state = REQUEST_STATE_RESPONSE_RECEIVED; request->state = REQUEST_STATE_RESPONSE_RECEIVED;
if (!(request->buffer = heap_alloc( buflen ))) return E_OUTOFMEMORY; if (!(request->buffer = heap_alloc( buflen ))) return E_OUTOFMEMORY;
request->buffer[0] = 0;
size = total_bytes_read = 0; size = total_bytes_read = 0;
do do
{ {

View File

@ -2473,6 +2473,7 @@ static void test_IWinHttpRequest(void)
SysFreeString( url ); SysFreeString( url );
SysFreeString( username ); SysFreeString( username );
SysFreeString( password ); SysFreeString( password );
SysFreeString( connection );
SysFreeString( date ); SysFreeString( date );
SysFreeString( today ); SysFreeString( today );
VariantClear( &proxy_server ); VariantClear( &proxy_server );