Commit 4519b1bd authored by Robert Shearman's avatar Robert Shearman Committed by Alexandre Julliard

- 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.
parent fc663043
...@@ -159,7 +159,6 @@ _unmarshal_interface(marshal_state *buf, REFIID riid, LPUNKNOWN *pUnk) { ...@@ -159,7 +159,6 @@ _unmarshal_interface(marshal_state *buf, REFIID riid, LPUNKNOWN *pUnk) {
static HRESULT static HRESULT
_marshal_interface(marshal_state *buf, REFIID riid, LPUNKNOWN pUnk) { _marshal_interface(marshal_state *buf, REFIID riid, LPUNKNOWN pUnk) {
LPUNKNOWN newiface = NULL;
LPBYTE tempbuf = NULL; LPBYTE tempbuf = NULL;
IStream *pStm = NULL; IStream *pStm = NULL;
STATSTG ststg; STATSTG ststg;
...@@ -183,11 +182,6 @@ _marshal_interface(marshal_state *buf, REFIID riid, LPUNKNOWN pUnk) { ...@@ -183,11 +182,6 @@ _marshal_interface(marshal_state *buf, REFIID riid, LPUNKNOWN pUnk) {
hres = E_FAIL; hres = E_FAIL;
TRACE("...%s...\n",debugstr_guid(riid)); 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); hres = CreateStreamOnHGlobal(0,TRUE,&pStm);
if (hres) { if (hres) {
...@@ -195,7 +189,7 @@ _marshal_interface(marshal_state *buf, REFIID riid, LPUNKNOWN pUnk) { ...@@ -195,7 +189,7 @@ _marshal_interface(marshal_state *buf, REFIID riid, LPUNKNOWN pUnk) {
goto fail; goto fail;
} }
hres = CoMarshalInterface(pStm,riid,newiface,0,NULL,0); hres = CoMarshalInterface(pStm,riid,pUnk,0,NULL,0);
if (hres) { if (hres) {
ERR("Marshalling interface %s failed with %lx\n", debugstr_guid(riid), hres); ERR("Marshalling interface %s failed with %lx\n", debugstr_guid(riid), hres);
goto fail; goto fail;
...@@ -226,7 +220,6 @@ _marshal_interface(marshal_state *buf, REFIID riid, LPUNKNOWN pUnk) { ...@@ -226,7 +220,6 @@ _marshal_interface(marshal_state *buf, REFIID riid, LPUNKNOWN pUnk) {
hres = xbuf_add(buf,tempbuf,ststg.cbSize.u.LowPart); hres = xbuf_add(buf,tempbuf,ststg.cbSize.u.LowPart);
HeapFree(GetProcessHeap(),0,tempbuf); HeapFree(GetProcessHeap(),0,tempbuf);
IUnknown_Release(newiface);
IStream_Release(pStm); IStream_Release(pStm);
return hres; return hres;
...@@ -235,7 +228,6 @@ fail: ...@@ -235,7 +228,6 @@ fail:
xsize = 0; xsize = 0;
xbuf_add(buf,(LPBYTE)&xsize,sizeof(xsize)); xbuf_add(buf,(LPBYTE)&xsize,sizeof(xsize));
if (pStm) IUnknown_Release(pStm); if (pStm) IUnknown_Release(pStm);
if (newiface) IUnknown_Release(newiface);
HeapFree(GetProcessHeap(), 0, tempbuf); HeapFree(GetProcessHeap(), 0, tempbuf);
return hres; return hres;
} }
...@@ -663,6 +655,8 @@ serialize_param( ...@@ -663,6 +655,8 @@ serialize_param(
case TKIND_INTERFACE: case TKIND_INTERFACE:
if (writeit) if (writeit)
hres=_marshal_interface(buf,&(tattr->guid),(LPUNKNOWN)arg); hres=_marshal_interface(buf,&(tattr->guid),(LPUNKNOWN)arg);
if (dealloc)
IUnknown_Release((LPUNKNOWN)arg);
break; break;
case TKIND_RECORD: { case TKIND_RECORD: {
int i; int i;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment