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

Dmitry Timoshkov dmitry at baikal.ru
Mon Dec 30 03:21:31 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/wbemdisp/locator.c          | 4 ++--
 dlls/wbemdisp/main.c             | 9 +++------
 dlls/wbemdisp/wbemdisp_private.h | 2 +-
 3 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/dlls/wbemdisp/locator.c b/dlls/wbemdisp/locator.c
index 68c24f7..e95b673 100644
--- a/dlls/wbemdisp/locator.c
+++ b/dlls/wbemdisp/locator.c
@@ -250,11 +250,11 @@ static const ISWbemLocatorVtbl locator_vtbl =
     locator_get_Security_
 };
 
-HRESULT SWbemLocator_create( IUnknown *unk, void **obj )
+HRESULT SWbemLocator_create( void **obj )
 {
     struct locator *locator;
 
-    TRACE( "%p, %p\n", unk, obj );
+    TRACE( "%p\n", obj );
 
     if (!(locator = heap_alloc( sizeof(*locator) ))) return E_OUTOFMEMORY;
     locator->ISWbemLocator_iface.lpVtbl = &locator_vtbl;
diff --git a/dlls/wbemdisp/main.c b/dlls/wbemdisp/main.c
index 8582cf1..af99975 100644
--- a/dlls/wbemdisp/main.c
+++ b/dlls/wbemdisp/main.c
@@ -80,7 +80,7 @@ static const IParseDisplayNameVtbl WinMGMTSVtbl = {
 
 static IParseDisplayName winmgmts = { &WinMGMTSVtbl };
 
-static HRESULT WinMGMTS_create(IUnknown *outer, void **ppv)
+static HRESULT WinMGMTS_create(void **ppv)
 {
     *ppv = &winmgmts;
     return S_OK;
@@ -89,7 +89,7 @@ static HRESULT WinMGMTS_create(IUnknown *outer, void **ppv)
 struct factory
 {
     IClassFactory IClassFactory_iface;
-    HRESULT (*fnCreateInstance)( IUnknown *, LPVOID * );
+    HRESULT (*fnCreateInstance)( LPVOID * );
 };
 
 static inline struct factory *impl_from_IClassFactory( IClassFactory *iface )
@@ -131,14 +131,11 @@ static HRESULT WINAPI factory_CreateInstance( IClassFactory *iface, LPUNKNOWN ou
     *obj = NULL;
     if (outer) return CLASS_E_NOAGGREGATION;
 
-    hr = factory->fnCreateInstance( outer, (LPVOID *)&unk );
+    hr = factory->fnCreateInstance( (LPVOID *)&unk );
     if (FAILED( hr ))
         return hr;
 
     hr = IUnknown_QueryInterface( unk, riid, obj );
-    if (FAILED( hr ))
-        return hr;
-
     IUnknown_Release( unk );
     return hr;
 }
diff --git a/dlls/wbemdisp/wbemdisp_private.h b/dlls/wbemdisp/wbemdisp_private.h
index 549cb28..cc84d72 100644
--- a/dlls/wbemdisp/wbemdisp_private.h
+++ b/dlls/wbemdisp/wbemdisp_private.h
@@ -16,7 +16,7 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
-HRESULT SWbemLocator_create(IUnknown *, LPVOID *) DECLSPEC_HIDDEN;
+HRESULT SWbemLocator_create(LPVOID *) DECLSPEC_HIDDEN;
 
 static void *heap_alloc( size_t len ) __WINE_ALLOC_SIZE(1);
 static inline void *heap_alloc( size_t len )
-- 
1.8.5.2




More information about the wine-patches mailing list