Skip to content

Commit

Permalink
Fix memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
nirbar committed Nov 21, 2024
1 parent 4aa6b0a commit f50bf86
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions PanelSwCustomActions/FileEntry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ CFileEntry::CFileEntry(const CFileEntry& other)
}
}

CFileEntry::CFileEntry(CFileEntry&& other)
CFileEntry::CFileEntry(CFileEntry&& other) noexcept
{
_szPath.Attach(other._szPath.Detach());
_szParentPath.Attach(other._szParentPath.Detach());
Expand Down Expand Up @@ -177,7 +177,7 @@ CFileEntry& CFileEntry::operator=(CFileEntry& other)
return *this;
}

CFileEntry& CFileEntry::operator=(CFileEntry&& other)
CFileEntry& CFileEntry::operator=(CFileEntry&& other) noexcept
{
_szPath.Attach(other._szPath.Detach());
_szParentPath.Attach(other._szParentPath.Detach());
Expand Down
4 changes: 2 additions & 2 deletions PanelSwCustomActions/FileEntry.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ class CFileEntry
CFileEntry(LPCWSTR szPath);
CFileEntry(const WIN32_FIND_DATA& findData, LPCWSTR szBasePath);
CFileEntry(const CFileEntry& other);
CFileEntry(CFileEntry&& other);
CFileEntry(CFileEntry&& other) noexcept;
CFileEntry& operator=(CFileEntry& other);
CFileEntry& operator=(CFileEntry&& other);
CFileEntry& operator=(CFileEntry&& other) noexcept;

// Attribute tests
DWORD Attributes() const;
Expand Down
2 changes: 1 addition & 1 deletion PanelSwCustomActions/FileIterator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ CFileEntry CFileIterator::Find(LPCWSTR szBasePath, LPCWSTR szPattern, bool bRecu

// We're searching without filespec wildcard pattern so we can match subfolders
_hFind = ::FindFirstFile(szBasePattern, &_findData);
ExitOnInvalidHandleWithLastError(_hFind, _hrStatus, "Failed to find files in '%ls'");
ExitOnInvalidHandleWithLastError(_hFind, _hrStatus, "Failed to find files in '%ls'", szBasePath);

return ProcessFindData();

Expand Down
3 changes: 3 additions & 0 deletions PanelSwCustomActions/PanelSwCustomActions.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,9 @@
<ClInclude Include="$(BuildFolder)\obj\$(Configuration)\Protobuf\obfuscatedString.pb.h">
<AutoGen>True</AutoGen>
</ClInclude>
<ClInclude Include="$(BuildFolder)\obj\$(Configuration)\Protobuf\reparsePointDetails.pb.h">
<AutoGen>True</AutoGen>
</ClInclude>
<ClInclude Include="TopShelfService.h" />
<ClInclude Include="Unzip.h" />
<ClInclude Include="XslTransform.h" />
Expand Down
1 change: 1 addition & 0 deletions PanelSwCustomActions/ReparsePoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,7 @@ HRESULT CReparsePoint::DeleteReparsePoint(LPCWSTR szPath, LPVOID pBuffer, DWORD
{
::CloseHandle(hFile);
}
ReleaseMem(pCurrReparseData)

return hr;
}

0 comments on commit f50bf86

Please sign in to comment.