David Hedberg : shell32: Always initialize shellitem to NULL in SHCreateShellItem.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Aug 4 15:29:38 CDT 2014


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

Author: David Hedberg <david.hedberg at gmail.com>
Date:   Wed Jul 30 20:43:23 2014 +0200

shell32: Always initialize shellitem to NULL in SHCreateShellItem.

---

 dlls/shell32/shellitem.c       | 3 ++-
 dlls/shell32/tests/shlfolder.c | 2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/dlls/shell32/shellitem.c b/dlls/shell32/shellitem.c
index 8236975..06b0783 100644
--- a/dlls/shell32/shellitem.c
+++ b/dlls/shell32/shellitem.c
@@ -555,6 +555,8 @@ HRESULT WINAPI SHCreateShellItem(LPCITEMIDLIST pidlParent,
 
     TRACE("(%p,%p,%p,%p)\n", pidlParent, psfParent, pidl, ppsi);
 
+    *ppsi = NULL;
+
     if (!pidl)
     {
         return E_INVALIDARG;
@@ -604,7 +606,6 @@ HRESULT WINAPI SHCreateShellItem(LPCITEMIDLIST pidlParent,
     }
     else
     {
-        *ppsi = NULL;
         ILFree(new_pidl);
     }
     return ret;
diff --git a/dlls/shell32/tests/shlfolder.c b/dlls/shell32/tests/shlfolder.c
index 4e20251..acb3517 100644
--- a/dlls/shell32/tests/shlfolder.c
+++ b/dlls/shell32/tests/shlfolder.c
@@ -2236,8 +2236,10 @@ static void test_SHCreateShellItem(void)
 
     pidl_abstestfile = pILCombine(pidl_cwd, pidl_testfile);
 
+    shellitem = (void*)0xdeadbeef;
     ret = pSHCreateShellItem(NULL, NULL, NULL, &shellitem);
     ok(ret == E_INVALIDARG, "SHCreateShellItem returned %x\n", ret);
+    ok(shellitem == 0, "Got %p\n", shellitem);
 
     if (0) /* crashes on Windows XP */
     {




More information about the wine-cvs mailing list