https://git.reactos.org/?p=reactos.git;a=commitdiff;h=bea7848fa9016a5db4cb2…
commit bea7848fa9016a5db4cb23f1159d769a3d3c7391
Author: William Kent <wjk011(a)gmail.com>
AuthorDate: Mon Aug 28 15:56:02 2023 -0400
Commit: GitHub <noreply(a)github.com>
CommitDate: Mon Aug 28 21:56:02 2023 +0200
[SHELL32] Add two missing GlobalUnlock() calls (#5625)
* [SHELL32] Release DROPFILES structures
* [SHELL32] Release the STGMEDIUM when returning on error
---
dll/win32/shell32/droptargets/CRecyclerDropTarget.cpp | 2 ++
dll/win32/shell32/droptargets/CexeDropHandler.cpp | 6 +++++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/dll/win32/shell32/droptargets/CRecyclerDropTarget.cpp
b/dll/win32/shell32/droptargets/CRecyclerDropTarget.cpp
index a29ec1e1c88..32f1f5f617a 100644
--- a/dll/win32/shell32/droptargets/CRecyclerDropTarget.cpp
+++ b/dll/win32/shell32/droptargets/CRecyclerDropTarget.cpp
@@ -46,6 +46,7 @@ class CRecyclerDropTarget :
if (!lpdf)
{
ERR("Error locking global\n");
+ ReleaseStgMedium(&medium);
return E_FAIL;
}
@@ -65,6 +66,7 @@ class CRecyclerDropTarget :
hr = E_FAIL;
}
+ GlobalUnlock(medium.hGlobal);
ReleaseStgMedium(&medium);
return hr;
diff --git a/dll/win32/shell32/droptargets/CexeDropHandler.cpp
b/dll/win32/shell32/droptargets/CexeDropHandler.cpp
index 2b8a915ff5a..1316385211a 100644
--- a/dll/win32/shell32/droptargets/CexeDropHandler.cpp
+++ b/dll/win32/shell32/droptargets/CexeDropHandler.cpp
@@ -72,6 +72,7 @@ HRESULT WINAPI CExeDropHandler::Drop(IDataObject *pDataObject, DWORD
dwKeyState,
if (!lpdf)
{
ERR("Error locking global\n");
+ ReleaseStgMedium(&medium);
return E_FAIL;
}
pszSrcList = (LPWSTR) (((byte*) lpdf) + lpdf->pFiles);
@@ -84,6 +85,9 @@ HRESULT WINAPI CExeDropHandler::Drop(IDataObject *pDataObject, DWORD
dwKeyState,
pszSrcList += wcslen(pszSrcList) + 1;
}
+
+ GlobalUnlock(medium.hGlobal);
+ ReleaseStgMedium(&medium);
}
ShellExecuteW(NULL, L"open", sPathTarget, wszBuf, NULL,SW_SHOWNORMAL);
@@ -138,4 +142,4 @@ HRESULT WINAPI CExeDropHandler::GetClassID(CLSID * lpClassId)
*lpClassId = *pclsid;
return S_OK;
-}
\ No newline at end of file
+}