Skip to content

Commit

Permalink
Cppcheck: Memory leak: hMemW
Browse files Browse the repository at this point in the history
  • Loading branch information
sdottaka committed May 2, 2024
1 parent 906f329 commit 4d8cec4
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Src/DirCmpReport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,10 @@ static HGLOBAL ConvertToUTF16ForClipboard(HGLOBAL hMem, int codepage)
LPCSTR pstr = reinterpret_cast<LPCSTR>(GlobalLock(hMem));
LPWSTR pwstr = reinterpret_cast<LPWSTR>(GlobalLock(hMemW));
if (pstr == nullptr || pwstr == nullptr)
{
GlobalFree(hMemW);
return nullptr;
}
int wlen = MultiByteToWideChar(codepage, 0, pstr, static_cast<int>(len), pwstr, static_cast<int>(len + 1));
if (len > 0 && pstr[len - 1] != '\0')
{
Expand Down

0 comments on commit 4d8cec4

Please sign in to comment.