1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-17 13:51:47 -05:00

Fix small memory leak in Packet demod

This commit is contained in:
Jon Beniston 2021-04-28 15:37:18 +01:00
parent 51960a869e
commit 9842e477af
2 changed files with 8 additions and 5 deletions

View File

@ -55,7 +55,7 @@ ADSBDemodSink::ADSBDemodSink() :
ADSBDemodSink::~ADSBDemodSink()
{
for (int i = 0; i < m_buffers; i++)
delete m_sampleBuffer[i];
delete[] m_sampleBuffer[i];
}
void ADSBDemodSink::feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end)
@ -207,7 +207,7 @@ void ADSBDemodSink::init(int samplesPerBit)
for (int i = 0; i < m_buffers; i++)
{
if (m_sampleBuffer[i])
delete m_sampleBuffer[i];
delete[] m_sampleBuffer[i];
}
m_samplesPerFrame = samplesPerBit*(ADS_B_PREAMBLE_BITS+ADS_B_ES_BITS);

View File

@ -55,6 +55,9 @@ PacketDemodSink::PacketDemodSink(PacketDemod *packetDemod) :
PacketDemodSink::~PacketDemodSink()
{
delete[] m_f1;
delete[] m_f0;
delete[] m_corrBuf;
}
void PacketDemodSink::feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end)
@ -301,9 +304,9 @@ void PacketDemodSink::applySettings(const PacketDemodSettings& settings, bool fo
if (force)
{
delete m_f1;
delete m_f0;
delete m_corrBuf;
delete[] m_f1;
delete[] m_f0;
delete[] m_corrBuf;
m_correlationLength = PACKETDEMOD_CHANNEL_SAMPLE_RATE/settings.m_baud;
m_f1 = new Complex[m_correlationLength]();
m_f0 = new Complex[m_correlationLength]();