Rob Shearman : ole32: Release iobject and the IRpcStubBuffer object no matter which code path we take .

Alexandre Julliard julliard at wine.codeweavers.com
Tue Feb 6 15:23:17 CST 2007


Module: wine
Branch: master
Commit: 723592cf5a8c72f1ad0ecbc8b2ded58385fb4558
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=723592cf5a8c72f1ad0ecbc8b2ded58385fb4558

Author: Rob Shearman <rob at codeweavers.com>
Date:   Tue Feb  6 19:21:40 2007 +0000

ole32: Release iobject and the IRpcStubBuffer object no matter which code path we take.

Otherwise we would leak a reference for both of these if the ifstub was already created.
Fix the FIXME in the code by releasing the stub manager if necessary.

---

 dlls/ole32/marshal.c |   21 +++++++++++----------
 1 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/dlls/ole32/marshal.c b/dlls/ole32/marshal.c
index 5b2d5b2..fc63450 100644
--- a/dlls/ole32/marshal.c
+++ b/dlls/ole32/marshal.c
@@ -155,17 +155,18 @@ HRESULT marshal_object(APARTMENT *apt, S
     /* make sure ifstub that we are creating is unique */
     ifstub = stub_manager_find_ifstub(manager, riid, mshlflags);
     if (!ifstub)
-    {
         ifstub = stub_manager_new_ifstub(manager, stub, iobject, riid, mshlflags);
-        IUnknown_Release(iobject);
-        if (stub) IRpcStubBuffer_Release(stub);
-        if (!ifstub)
-        {
-            stub_manager_int_release(manager);
-            /* FIXME: should we do another release to completely destroy the
-             * stub manager? */
-            return E_OUTOFMEMORY;
-        }
+
+    if (stub) IRpcStubBuffer_Release(stub);
+    IUnknown_Release(iobject);
+
+    if (!ifstub)
+    {
+        stub_manager_int_release(manager);
+        /* destroy the stub manager if it has no ifstubs by releasing
+         * zero external references */
+        stub_manager_ext_release(manager, 0, TRUE);
+        return E_OUTOFMEMORY;
     }
 
     if (!tablemarshal)




More information about the wine-cvs mailing list