Skip to content

Commit

Permalink
Better comment
Browse files Browse the repository at this point in the history
  • Loading branch information
abique committed Sep 16, 2023
1 parent 45211b7 commit 1a083b6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/util/samplebuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ SampleBuffer::SampleBuffer(SINT size)
SampleBuffer::~SampleBuffer() {
SampleUtil::free(m_data);

/* cleanup the memory, just in case of use after free */
// Cleanup the pointer, because if this object is used after free,
// it is preferable to have a null pointer rather than a heap pointer
// which will in the best case lead to a crash and worst case just
// corrupt random heap memory and make it hard to find the root issue.
m_data = nullptr;
m_size = 0;
}
Expand Down

0 comments on commit 1a083b6

Please sign in to comment.