https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5be53f553c7f032701a8817941af14ebeddf8fc8
commit 5be53f553c7f032701a8817941af14ebeddf8fc8 Author: Whindmar Saksit <whinds...@proton.me> AuthorDate: Sun Dec 17 22:16:19 2023 +0100 Commit: GitHub <nore...@github.com> CommitDate: Sun Dec 17 22:16:19 2023 +0100 [BROWSEUI] Don't call SHOpenFolderAndSelectItems with full pidls and don't leak them (#6153) - The children passed to SHOpenFolderAndSelectItems are not supposed to be full pidls. - Don't leak the array from IShellFolderView::GetSelectedObjects. --- dll/win32/browseui/shellfind/CFindFolder.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/dll/win32/browseui/shellfind/CFindFolder.cpp b/dll/win32/browseui/shellfind/CFindFolder.cpp index 6108970fb55..999e57658eb 100644 --- a/dll/win32/browseui/shellfind/CFindFolder.cpp +++ b/dll/win32/browseui/shellfind/CFindFolder.cpp @@ -809,11 +809,10 @@ class CFindFolderContextMenu : CComHeapPtr<ITEMIDLIST> folderPidl(ILCreateFromPathW(_ILGetPath(apidl[i]))); if (!folderPidl) return E_OUTOFMEMORY; - CComHeapPtr<ITEMIDLIST> filePidl(ILCombine(folderPidl, _ILGetFSPidl(apidl[i]))); - if (!filePidl) - return E_OUTOFMEMORY; - SHOpenFolderAndSelectItems(folderPidl, 1, &filePidl, 0); + LPCITEMIDLIST child = _ILGetFSPidl(apidl[i]); + SHOpenFolderAndSelectItems(folderPidl, 1, &child, 0); } + LocalFree(apidl); // Yes, LocalFree return S_OK; }