winhttp: Remove unused IUnknown *outer parameter from object constructor.

Dmitry Timoshkov dmitry at baikal.ru
Mon Dec 30 03:21:27 CST 2013


The patch also fixes a memory leak in the object creation failure case.

Class factory explicitly checks for it:

if (outer) return CLASS_E_NOAGGREGATION;
obj_constructor(outer, &obj);

i.e. outer is always NULL in the object constructor.
---
 dlls/winhttp/main.c            | 7 ++-----
 dlls/winhttp/request.c         | 4 ++--
 dlls/winhttp/winhttp_private.h | 2 +-
 3 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/dlls/winhttp/main.c b/dlls/winhttp/main.c
index 5827c10..9cdcc98 100644
--- a/dlls/winhttp/main.c
+++ b/dlls/winhttp/main.c
@@ -53,7 +53,7 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
     return TRUE;
 }
 
-typedef HRESULT (*fnCreateInstance)( IUnknown *outer, void **obj );
+typedef HRESULT (*fnCreateInstance)( void **obj );
 
 struct winhttp_cf
 {
@@ -110,14 +110,11 @@ static HRESULT WINAPI requestcf_CreateInstance(
     if (outer)
         return CLASS_E_NOAGGREGATION;
 
-    hr = cf->pfnCreateInstance( outer, (void **)&unknown );
+    hr = cf->pfnCreateInstance( (void **)&unknown );
     if (FAILED(hr))
         return hr;
 
     hr = IUnknown_QueryInterface( unknown, riid, obj );
-    if (FAILED(hr))
-        return hr;
-
     IUnknown_Release( unknown );
     return hr;
 }
diff --git a/dlls/winhttp/request.c b/dlls/winhttp/request.c
index 84a0ed1..ed3430a 100644
--- a/dlls/winhttp/request.c
+++ b/dlls/winhttp/request.c
@@ -3814,11 +3814,11 @@ static const struct IWinHttpRequestVtbl winhttp_request_vtbl =
     winhttp_request_SetAutoLogonPolicy
 };
 
-HRESULT WinHttpRequest_create( IUnknown *unknown, void **obj )
+HRESULT WinHttpRequest_create( void **obj )
 {
     struct winhttp_request *request;
 
-    TRACE("%p, %p\n", unknown, obj);
+    TRACE("%p\n", obj);
 
     if (!(request = heap_alloc( sizeof(*request) ))) return E_OUTOFMEMORY;
     request->IWinHttpRequest_iface.lpVtbl = &winhttp_request_vtbl;
diff --git a/dlls/winhttp/winhttp_private.h b/dlls/winhttp/winhttp_private.h
index a149160..8f26704 100644
--- a/dlls/winhttp/winhttp_private.h
+++ b/dlls/winhttp/winhttp_private.h
@@ -282,7 +282,7 @@ void delete_domain( domain_t * ) DECLSPEC_HIDDEN;
 BOOL set_server_for_hostname( connect_t *, LPCWSTR, INTERNET_PORT ) DECLSPEC_HIDDEN;
 void destroy_authinfo( struct authinfo * ) DECLSPEC_HIDDEN;
 
-extern HRESULT WinHttpRequest_create( IUnknown *, void ** ) DECLSPEC_HIDDEN;
+extern HRESULT WinHttpRequest_create( void ** ) DECLSPEC_HIDDEN;
 
 static inline const char *debugstr_variant( const VARIANT *v )
 {
-- 
1.8.5.2




More information about the wine-patches mailing list