From 4519b1bd1d62698f649a00918f6bc95cddc0324b Mon Sep 17 00:00:00 2001 From: Robert Shearman Date: Wed, 24 Aug 2005 09:44:41 +0000 Subject: [PATCH] - Remove redundant QueryInterface in marshal_interface - the object is always queried later on for the correct interface of the object. - Make sure to Release the marshaled pointer in the typelib marshaler once it is no longer required. --- dlls/oleaut32/tmarshal.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/dlls/oleaut32/tmarshal.c b/dlls/oleaut32/tmarshal.c index 71256b72d3e..eded5c64df5 100644 --- a/dlls/oleaut32/tmarshal.c +++ b/dlls/oleaut32/tmarshal.c @@ -159,7 +159,6 @@ _unmarshal_interface(marshal_state *buf, REFIID riid, LPUNKNOWN *pUnk) { static HRESULT _marshal_interface(marshal_state *buf, REFIID riid, LPUNKNOWN pUnk) { - LPUNKNOWN newiface = NULL; LPBYTE tempbuf = NULL; IStream *pStm = NULL; STATSTG ststg; @@ -183,11 +182,6 @@ _marshal_interface(marshal_state *buf, REFIID riid, LPUNKNOWN pUnk) { hres = E_FAIL; TRACE("...%s...\n",debugstr_guid(riid)); - hres = IUnknown_QueryInterface(pUnk,riid,(LPVOID*)&newiface); - if (hres) { - WARN("%p does not support iface %s\n",pUnk,debugstr_guid(riid)); - goto fail; - } hres = CreateStreamOnHGlobal(0,TRUE,&pStm); if (hres) { @@ -195,7 +189,7 @@ _marshal_interface(marshal_state *buf, REFIID riid, LPUNKNOWN pUnk) { goto fail; } - hres = CoMarshalInterface(pStm,riid,newiface,0,NULL,0); + hres = CoMarshalInterface(pStm,riid,pUnk,0,NULL,0); if (hres) { ERR("Marshalling interface %s failed with %lx\n", debugstr_guid(riid), hres); goto fail; @@ -226,7 +220,6 @@ _marshal_interface(marshal_state *buf, REFIID riid, LPUNKNOWN pUnk) { hres = xbuf_add(buf,tempbuf,ststg.cbSize.u.LowPart); HeapFree(GetProcessHeap(),0,tempbuf); - IUnknown_Release(newiface); IStream_Release(pStm); return hres; @@ -235,7 +228,6 @@ fail: xsize = 0; xbuf_add(buf,(LPBYTE)&xsize,sizeof(xsize)); if (pStm) IUnknown_Release(pStm); - if (newiface) IUnknown_Release(newiface); HeapFree(GetProcessHeap(), 0, tempbuf); return hres; } @@ -663,6 +655,8 @@ serialize_param( case TKIND_INTERFACE: if (writeit) hres=_marshal_interface(buf,&(tattr->guid),(LPUNKNOWN)arg); + if (dealloc) + IUnknown_Release((LPUNKNOWN)arg); break; case TKIND_RECORD: { int i; -- 2.11.4.GIT