Skip to content
This repository was archived by the owner on Oct 4, 2022. It is now read-only.

Fixes for AudioEngine gem heap memory corruption #459

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ namespace Audio
if (IsOk())
{
// Allocate a new buffer to hold the data...
m_dataPtr = new AZ::u8[m_dataSize];
m_dataPtr = static_cast<AZ::u8*>(azmalloc(m_dataSize));

// Read file into internal buffer...
size_t bytesRead = fileStream.Read(m_dataSize, m_dataPtr);
Expand All @@ -110,7 +110,7 @@ namespace Audio
{
if (m_dataPtr)
{
delete [] m_dataPtr;
azfree(m_dataPtr);
m_dataPtr = nullptr;
}
m_dataSize = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ namespace Audio

if (m_config.m_sampleType == AudioInputSampleType::Float && m_config.m_bitsPerSample == 32)
{
m_buffer.reset(new RingBuffer<float>(numSamples));
m_buffer.reset(aznew RingBuffer<float>(numSamples));
}
else if (m_config.m_sampleType == AudioInputSampleType::Int && m_config.m_bitsPerSample == 16)
{
m_buffer.reset(new RingBuffer<AZ::s16>(numSamples));
m_buffer.reset(aznew RingBuffer<AZ::s16>(numSamples));
}
else
{
Expand Down