winhttp: Fix some memory leaks.
This commit is contained in:
parent
3762de9d8c
commit
d5a98e5d85
|
@ -2403,20 +2403,32 @@ static HRESULT WINAPI winhttp_request_SetProxy(
|
||||||
{
|
{
|
||||||
case HTTPREQUEST_PROXYSETTING_DEFAULT:
|
case HTTPREQUEST_PROXYSETTING_DEFAULT:
|
||||||
request->proxy.dwAccessType = WINHTTP_ACCESS_TYPE_DEFAULT_PROXY;
|
request->proxy.dwAccessType = WINHTTP_ACCESS_TYPE_DEFAULT_PROXY;
|
||||||
|
heap_free( (WCHAR *)request->proxy.lpszProxy );
|
||||||
|
heap_free( (WCHAR *)request->proxy.lpszProxyBypass );
|
||||||
request->proxy.lpszProxy = NULL;
|
request->proxy.lpszProxy = NULL;
|
||||||
request->proxy.lpszProxyBypass = NULL;
|
request->proxy.lpszProxyBypass = NULL;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HTTPREQUEST_PROXYSETTING_DIRECT:
|
case HTTPREQUEST_PROXYSETTING_DIRECT:
|
||||||
request->proxy.dwAccessType = WINHTTP_ACCESS_TYPE_NO_PROXY;
|
request->proxy.dwAccessType = WINHTTP_ACCESS_TYPE_NO_PROXY;
|
||||||
|
heap_free( (WCHAR *)request->proxy.lpszProxy );
|
||||||
|
heap_free( (WCHAR *)request->proxy.lpszProxyBypass );
|
||||||
request->proxy.lpszProxy = NULL;
|
request->proxy.lpszProxy = NULL;
|
||||||
request->proxy.lpszProxyBypass = NULL;
|
request->proxy.lpszProxyBypass = NULL;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HTTPREQUEST_PROXYSETTING_PROXY:
|
case HTTPREQUEST_PROXYSETTING_PROXY:
|
||||||
request->proxy.dwAccessType = WINHTTP_ACCESS_TYPE_NAMED_PROXY;
|
request->proxy.dwAccessType = WINHTTP_ACCESS_TYPE_NAMED_PROXY;
|
||||||
if (V_VT( &proxy_server ) == VT_BSTR) request->proxy.lpszProxy = strdupW( V_BSTR( &proxy_server ) );
|
if (V_VT( &proxy_server ) == VT_BSTR)
|
||||||
if (V_VT( &bypass_list ) == VT_BSTR) request->proxy.lpszProxyBypass = strdupW( V_BSTR( &bypass_list ) );
|
{
|
||||||
|
heap_free( (WCHAR *)request->proxy.lpszProxy );
|
||||||
|
request->proxy.lpszProxy = strdupW( V_BSTR( &proxy_server ) );
|
||||||
|
}
|
||||||
|
if (V_VT( &bypass_list ) == VT_BSTR)
|
||||||
|
{
|
||||||
|
heap_free( (WCHAR *)request->proxy.lpszProxyBypass );
|
||||||
|
request->proxy.lpszProxyBypass = strdupW( V_BSTR( &bypass_list ) );
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -3334,6 +3346,8 @@ HRESULT WinHttpRequest_create( IUnknown *unknown, void **obj )
|
||||||
request->IWinHttpRequest_iface.lpVtbl = &winhttp_request_vtbl;
|
request->IWinHttpRequest_iface.lpVtbl = &winhttp_request_vtbl;
|
||||||
request->refs = 1;
|
request->refs = 1;
|
||||||
request->state = REQUEST_STATE_UNINITIALIZED;
|
request->state = REQUEST_STATE_UNINITIALIZED;
|
||||||
|
request->proxy.lpszProxy = NULL;
|
||||||
|
request->proxy.lpszProxyBypass = NULL;
|
||||||
InitializeCriticalSection( &request->cs );
|
InitializeCriticalSection( &request->cs );
|
||||||
|
|
||||||
*obj = &request->IWinHttpRequest_iface;
|
*obj = &request->IWinHttpRequest_iface;
|
||||||
|
|
|
@ -206,6 +206,7 @@ HINTERNET WINAPI WinHttpOpen( LPCWSTR agent, DWORD access, LPCWSTR proxy, LPCWST
|
||||||
session->hdr.flags = flags;
|
session->hdr.flags = flags;
|
||||||
session->hdr.refs = 1;
|
session->hdr.refs = 1;
|
||||||
session->hdr.redirect_policy = WINHTTP_OPTION_REDIRECT_POLICY_DISALLOW_HTTPS_TO_HTTP;
|
session->hdr.redirect_policy = WINHTTP_OPTION_REDIRECT_POLICY_DISALLOW_HTTPS_TO_HTTP;
|
||||||
|
list_init( &session->hdr.children );
|
||||||
session->resolve_timeout = DEFAULT_RESOLVE_TIMEOUT;
|
session->resolve_timeout = DEFAULT_RESOLVE_TIMEOUT;
|
||||||
session->connect_timeout = DEFAULT_CONNECT_TIMEOUT;
|
session->connect_timeout = DEFAULT_CONNECT_TIMEOUT;
|
||||||
session->send_timeout = DEFAULT_SEND_TIMEOUT;
|
session->send_timeout = DEFAULT_SEND_TIMEOUT;
|
||||||
|
@ -498,6 +499,7 @@ HINTERNET WINAPI WinHttpConnect( HINTERNET hsession, LPCWSTR server, INTERNET_PO
|
||||||
connect->hdr.callback = session->hdr.callback;
|
connect->hdr.callback = session->hdr.callback;
|
||||||
connect->hdr.notify_mask = session->hdr.notify_mask;
|
connect->hdr.notify_mask = session->hdr.notify_mask;
|
||||||
connect->hdr.context = session->hdr.context;
|
connect->hdr.context = session->hdr.context;
|
||||||
|
list_init( &connect->hdr.children );
|
||||||
|
|
||||||
addref_object( &session->hdr );
|
addref_object( &session->hdr );
|
||||||
connect->session = session;
|
connect->session = session;
|
||||||
|
@ -505,9 +507,7 @@ HINTERNET WINAPI WinHttpConnect( HINTERNET hsession, LPCWSTR server, INTERNET_PO
|
||||||
|
|
||||||
if (!(connect->hostname = strdupW( server ))) goto end;
|
if (!(connect->hostname = strdupW( server ))) goto end;
|
||||||
connect->hostport = port;
|
connect->hostport = port;
|
||||||
|
if (!set_server_for_hostname( connect, server, port )) goto end;
|
||||||
if (!set_server_for_hostname( connect, server, port ))
|
|
||||||
goto end;
|
|
||||||
|
|
||||||
if (!(hconnect = alloc_handle( &connect->hdr ))) goto end;
|
if (!(hconnect = alloc_handle( &connect->hdr ))) goto end;
|
||||||
connect->hdr.handle = hconnect;
|
connect->hdr.handle = hconnect;
|
||||||
|
@ -516,7 +516,7 @@ HINTERNET WINAPI WinHttpConnect( HINTERNET hsession, LPCWSTR server, INTERNET_PO
|
||||||
|
|
||||||
end:
|
end:
|
||||||
release_object( &connect->hdr );
|
release_object( &connect->hdr );
|
||||||
|
release_object( &session->hdr );
|
||||||
TRACE("returning %p\n", hconnect);
|
TRACE("returning %p\n", hconnect);
|
||||||
return hconnect;
|
return hconnect;
|
||||||
}
|
}
|
||||||
|
@ -930,6 +930,7 @@ HINTERNET WINAPI WinHttpOpenRequest( HINTERNET hconnect, LPCWSTR verb, LPCWSTR o
|
||||||
request->hdr.callback = connect->hdr.callback;
|
request->hdr.callback = connect->hdr.callback;
|
||||||
request->hdr.notify_mask = connect->hdr.notify_mask;
|
request->hdr.notify_mask = connect->hdr.notify_mask;
|
||||||
request->hdr.context = connect->hdr.context;
|
request->hdr.context = connect->hdr.context;
|
||||||
|
list_init( &request->hdr.children );
|
||||||
|
|
||||||
addref_object( &connect->hdr );
|
addref_object( &connect->hdr );
|
||||||
request->connect = connect;
|
request->connect = connect;
|
||||||
|
@ -970,7 +971,7 @@ HINTERNET WINAPI WinHttpOpenRequest( HINTERNET hconnect, LPCWSTR verb, LPCWSTR o
|
||||||
|
|
||||||
end:
|
end:
|
||||||
release_object( &request->hdr );
|
release_object( &request->hdr );
|
||||||
|
release_object( &connect->hdr );
|
||||||
TRACE("returning %p\n", hrequest);
|
TRACE("returning %p\n", hrequest);
|
||||||
return hrequest;
|
return hrequest;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue