Huw Davies : shell32: Add a test to show the IShellLink_GetIDList returns a copy of the IDList, remove an incorrect comment and fix a memory leak.

Alexandre Julliard julliard at winehq.org
Fri Jan 22 08:26:55 CST 2010


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

Author: Huw Davies <huw at codeweavers.com>
Date:   Fri Jan 22 12:08:47 2010 +0000

shell32: Add a test to show the IShellLink_GetIDList returns a copy of the IDList, remove an incorrect comment and fix a memory leak.

Found by Valgrind.

---

 dlls/shell32/tests/shelllink.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/dlls/shell32/tests/shelllink.c b/dlls/shell32/tests/shelllink.c
index 2535471..bb2d5b3 100644
--- a/dlls/shell32/tests/shelllink.c
+++ b/dlls/shell32/tests/shelllink.c
@@ -207,6 +207,7 @@ static void test_get_set(void)
         }
         if (ret)
             ok(lstrcmpi(buffer,str)==0, "GetIDList returned '%s'\n", buffer);
+        pILFree(tmp_pidl);
     }
 
     pidl=path_to_pidl(mypath);
@@ -214,6 +215,8 @@ static void test_get_set(void)
 
     if (pidl)
     {
+        LPITEMIDLIST second_pidl;
+
         r = IShellLinkA_SetIDList(sl, pidl);
         ok(SUCCEEDED(r), "SetIDList failed (0x%08x)\n", r);
 
@@ -223,7 +226,14 @@ static void test_get_set(void)
         ok(tmp_pidl && pILIsEqual(pidl, tmp_pidl),
            "GetIDList returned an incorrect pidl\n");
 
-        /* tmp_pidl is owned by IShellLink so we don't free it */
+        r = IShellLinkA_GetIDList(sl, &second_pidl);
+        ok(SUCCEEDED(r), "GetIDList failed (0x%08x)\n", r);
+        ok(second_pidl && pILIsEqual(pidl, second_pidl),
+           "GetIDList returned an incorrect pidl\n");
+        ok(second_pidl != tmp_pidl, "pidls are the same\n");
+
+        pILFree(second_pidl);
+        pILFree(tmp_pidl);
         pILFree(pidl);
 
         strcpy(buffer,"garbage");




More information about the wine-cvs mailing list