From 7c7a7d7c1eae756c1516f1d7ee0a99e1204b8d89 Mon Sep 17 00:00:00 2001 From: srcejon Date: Thu, 14 Nov 2024 11:40:46 +0000 Subject: [PATCH] FreeDV: Fix memory allocation/free issues. Part of #2315. --- plugins/channelrx/demodfreedv/freedvdemod.cpp | 1 + plugins/channelrx/demodfreedv/freedvdemodsink.cpp | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/channelrx/demodfreedv/freedvdemod.cpp b/plugins/channelrx/demodfreedv/freedvdemod.cpp index 1d6dd4a31..3b996ffcf 100644 --- a/plugins/channelrx/demodfreedv/freedvdemod.cpp +++ b/plugins/channelrx/demodfreedv/freedvdemod.cpp @@ -79,6 +79,7 @@ FreeDVDemod::FreeDVDemod(DeviceAPI *deviceAPI) : FreeDVDemod::~FreeDVDemod() { + stop(); QObject::disconnect( m_networkManager, &QNetworkAccessManager::finished, diff --git a/plugins/channelrx/demodfreedv/freedvdemodsink.cpp b/plugins/channelrx/demodfreedv/freedvdemodsink.cpp index 070ed4048..dc05bdd99 100644 --- a/plugins/channelrx/demodfreedv/freedvdemodsink.cpp +++ b/plugins/channelrx/demodfreedv/freedvdemodsink.cpp @@ -176,6 +176,8 @@ FreeDVDemodSink::~FreeDVDemodSink() { delete SSBFilter; delete[] m_SSBFilterBuffer; + delete[] m_speechOut; + delete[] m_modIn; } void FreeDVDemodSink::feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end) @@ -449,7 +451,7 @@ void FreeDVDemodSink::applyFreeDVMode(FreeDVDemodSettings::FreeDVMode mode) freedv_set_ext_vco(m_freeDV, 0); freedv_set_sync(m_freeDV, FREEDV_SYNC_MANUAL); - int nSpeechSamples = freedv_get_n_speech_samples(m_freeDV); + int nSpeechSamples = freedv_get_n_max_speech_samples(m_freeDV); int nMaxModemSamples = freedv_get_n_max_modem_samples(m_freeDV); int Fs = freedv_get_modem_sample_rate(m_freeDV); int Rs = freedv_get_modem_symbol_rate(m_freeDV);