APT demod: fixed some possible memory leaks

pull/875/head
f4exb 2021-04-25 19:16:50 +02:00
rodzic 8c9f5ff14c
commit e8dec5db83
1 zmienionych plików z 5 dodań i 5 usunięć

Wyświetl plik

@ -65,7 +65,7 @@ void APTDemodSink::resetDecoder()
APTDemodSink::~APTDemodSink() APTDemodSink::~APTDemodSink()
{ {
delete m_samples; delete[] m_samples;
} }
// callback from APT library to get audio samples // callback from APT library to get audio samples
@ -122,10 +122,10 @@ void APTDemodSink::feed(const SampleVector::const_iterator& begin, const SampleV
// 2 lines per second // 2 lines per second
if (m_sampleCount >= APTDEMOD_AUDIO_SAMPLE_RATE) if (m_sampleCount >= APTDEMOD_AUDIO_SAMPLE_RATE)
{ {
float *pixels = new float[APT_PROW_WIDTH]; if (getImageWorkerMessageQueue())
apt_getpixelrow(pixels, m_row, &m_zenith, m_row == 0, getsamples, this); {
float *pixels = new float[APT_PROW_WIDTH];
if (getImageWorkerMessageQueue()) { apt_getpixelrow(pixels, m_row, &m_zenith, m_row == 0, getsamples, this);
getImageWorkerMessageQueue()->push(APTDemod::MsgPixels::create(pixels, m_zenith)); getImageWorkerMessageQueue()->push(APTDemod::MsgPixels::create(pixels, m_zenith));
} }