shell32: Always initialize shellitem to NULL in SHCreateShellItem.

This commit is contained in:
David Hedberg 2014-07-30 20:43:23 +02:00 committed by Alexandre Julliard
parent 9ff6853478
commit 815b532b64
2 changed files with 4 additions and 1 deletions

View File

@ -555,6 +555,8 @@ HRESULT WINAPI SHCreateShellItem(LPCITEMIDLIST pidlParent,
TRACE("(%p,%p,%p,%p)\n", pidlParent, psfParent, pidl, ppsi); TRACE("(%p,%p,%p,%p)\n", pidlParent, psfParent, pidl, ppsi);
*ppsi = NULL;
if (!pidl) if (!pidl)
{ {
return E_INVALIDARG; return E_INVALIDARG;
@ -604,7 +606,6 @@ HRESULT WINAPI SHCreateShellItem(LPCITEMIDLIST pidlParent,
} }
else else
{ {
*ppsi = NULL;
ILFree(new_pidl); ILFree(new_pidl);
} }
return ret; return ret;

View File

@ -2236,8 +2236,10 @@ static void test_SHCreateShellItem(void)
pidl_abstestfile = pILCombine(pidl_cwd, pidl_testfile); pidl_abstestfile = pILCombine(pidl_cwd, pidl_testfile);
shellitem = (void*)0xdeadbeef;
ret = pSHCreateShellItem(NULL, NULL, NULL, &shellitem); ret = pSHCreateShellItem(NULL, NULL, NULL, &shellitem);
ok(ret == E_INVALIDARG, "SHCreateShellItem returned %x\n", ret); ok(ret == E_INVALIDARG, "SHCreateShellItem returned %x\n", ret);
ok(shellitem == 0, "Got %p\n", shellitem);
if (0) /* crashes on Windows XP */ if (0) /* crashes on Windows XP */
{ {