[SHELL32] Add two missing GlobalUnlock() calls (#5625)

* [SHELL32] Release DROPFILES structures
* [SHELL32] Release the STGMEDIUM when returning on error
This commit is contained in:
William Kent 2023-08-28 15:56:02 -04:00 committed by GitHub
parent 29fbe60abe
commit bea7848fa9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View file

@ -46,6 +46,7 @@ class CRecyclerDropTarget :
if (!lpdf) if (!lpdf)
{ {
ERR("Error locking global\n"); ERR("Error locking global\n");
ReleaseStgMedium(&medium);
return E_FAIL; return E_FAIL;
} }
@ -65,6 +66,7 @@ class CRecyclerDropTarget :
hr = E_FAIL; hr = E_FAIL;
} }
GlobalUnlock(medium.hGlobal);
ReleaseStgMedium(&medium); ReleaseStgMedium(&medium);
return hr; return hr;

View file

@ -72,6 +72,7 @@ HRESULT WINAPI CExeDropHandler::Drop(IDataObject *pDataObject, DWORD dwKeyState,
if (!lpdf) if (!lpdf)
{ {
ERR("Error locking global\n"); ERR("Error locking global\n");
ReleaseStgMedium(&medium);
return E_FAIL; return E_FAIL;
} }
pszSrcList = (LPWSTR) (((byte*) lpdf) + lpdf->pFiles); pszSrcList = (LPWSTR) (((byte*) lpdf) + lpdf->pFiles);
@ -84,6 +85,9 @@ HRESULT WINAPI CExeDropHandler::Drop(IDataObject *pDataObject, DWORD dwKeyState,
pszSrcList += wcslen(pszSrcList) + 1; pszSrcList += wcslen(pszSrcList) + 1;
} }
GlobalUnlock(medium.hGlobal);
ReleaseStgMedium(&medium);
} }
ShellExecuteW(NULL, L"open", sPathTarget, wszBuf, NULL,SW_SHOWNORMAL); ShellExecuteW(NULL, L"open", sPathTarget, wszBuf, NULL,SW_SHOWNORMAL);
@ -138,4 +142,4 @@ HRESULT WINAPI CExeDropHandler::GetClassID(CLSID * lpClassId)
*lpClassId = *pclsid; *lpClassId = *pclsid;
return S_OK; return S_OK;
} }