[3/4] shell32: Release shell folders obtained via IFolderView_GetFolder.

Thomas Faber thomas.faber at reactos.org
Mon Jun 29 16:10:42 CDT 2015


As a consequence of the previous patch, Wine now leaks shell folder
references after calling GetFolder. This fixes the call sites to
release them.
-------------- next part --------------
From 1c35d636ef576e3a6a97d170996539be9dde5d11 Mon Sep 17 00:00:00 2001
From: Thomas Faber <thomas.faber at reactos.org>
Date: Mon, 29 Jun 2015 16:07:54 -0400
Subject: shell32: Release shell folders obtained via IFolderView_GetFolder.

---
 dlls/shell32/pidl.c           |    1 +
 dlls/shell32/tests/ebrowser.c |    2 +-
 dlls/shell32/tests/shlview.c  |    1 +
 3 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/dlls/shell32/pidl.c b/dlls/shell32/pidl.c
index d16ca57..1856c12 100644
--- a/dlls/shell32/pidl.c
+++ b/dlls/shell32/pidl.c
@@ -1477,6 +1477,7 @@ HRESULT WINAPI SHGetIDListFromObject(IUnknown *punk, PIDLIST_ABSOLUTE *ppidl)
         {
             /* We might be able to get IPersistFolder2 from a shellfolder. */
             ret = SHGetIDListFromObject((IUnknown*)psf, ppidl);
+            IShellFolder_Release(psf);
         }
         IFolderView_Release(pfv);
         return ret;
diff --git a/dlls/shell32/tests/ebrowser.c b/dlls/shell32/tests/ebrowser.c
index 4c255a1..c9d81a4 100644
--- a/dlls/shell32/tests/ebrowser.c
+++ b/dlls/shell32/tests/ebrowser.c
@@ -1469,7 +1469,7 @@ static void test_navigation(void)
         test_browse_pidl_sb(peb2, &ebev, pidl_relative, SBSP_RELATIVE, S_OK, 1, 1, 0, 1);
 
         ILFree(pidl_relative);
-        /* IShellFolder_Release(psf); */
+        IShellFolder_Release(psf);
         IFolderView_Release(pfv);
     }
 
diff --git a/dlls/shell32/tests/shlview.c b/dlls/shell32/tests/shlview.c
index 05fc7ee..af57e60 100644
--- a/dlls/shell32/tests/shlview.c
+++ b/dlls/shell32/tests/shlview.c
@@ -831,6 +831,7 @@ if (0)
     ok(ref1 == ref2 || ref1 + 1 == ref2, /* >= vista */
        "expected same refcount, got %d\n", ref2);
     ok(desktop == folder, "\n");
+    if (folder) IShellFolder_Release(folder);
 
     hr = IFolderView_GetFolder(fv, &IID_IUnknown, (void**)&unk);
     ok(hr == S_OK, "got (0x%08x)\n", hr);
-- 
1.7.1



More information about the wine-patches mailing list