Skip to content

Commit

Permalink
Fix potential leaks in move assignment operator (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
sbooth authored Sep 25, 2024
1 parent ba5c23e commit c4f71d6
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Sources/CXXAudioUtilities/include/SFBCAAUGraph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ class CAAUGraph
CAAUGraph& operator=(CAAUGraph&& rhs) noexcept
{
if(this != &rhs) {
if(mAUGraph)
DisposeAUGraph(mAUGraph);
mAUGraph = rhs.mAUGraph;
rhs.mAUGraph = nullptr;
}
Expand Down
2 changes: 2 additions & 0 deletions Sources/CXXAudioUtilities/include/SFBCAAudioConverter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ class CAAudioConverter
CAAudioConverter& operator=(CAAudioConverter&& rhs) noexcept
{
if(this != &rhs) {
if(mConverter)
AudioConverterDispose(mConverter);
mConverter = rhs.mConverter;
rhs.mConverter = nullptr;
}
Expand Down
2 changes: 2 additions & 0 deletions Sources/CXXAudioUtilities/include/SFBCAAudioFile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ class CAAudioFile
CAAudioFile& operator=(CAAudioFile&& rhs) noexcept
{
if(this != &rhs) {
if(mAudioFileID)
AudioFileClose(mAudioFileID);
mAudioFileID = rhs.mAudioFileID;
rhs.mAudioFileID = nullptr;
}
Expand Down
2 changes: 2 additions & 0 deletions Sources/CXXAudioUtilities/include/SFBCAExtAudioFile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ class CAExtAudioFile
CAExtAudioFile& operator=(CAExtAudioFile&& rhs) noexcept
{
if(this != &rhs) {
if(mExtAudioFile)
ExtAudioFileDispose(mExtAudioFile);
mExtAudioFile = rhs.mExtAudioFile;
rhs.mExtAudioFile = nullptr;
}
Expand Down

0 comments on commit c4f71d6

Please sign in to comment.