Commit Graph
6576 Commits
Author SHA1 Message Date
Edouard Griffiths d8feb80e98 Merge pull request #2880 from rgetz/rgetz-fix-resource-leaks
Fix resource ownership and cleanup issues across several SDRangel components.
2026-08-16 06:15:24 +02:00
Edouard Griffiths c861ae06a3 Merge pull request #2869 from rgetz/rgetz-fix-containerOutOfBounds
Fix cppcheck-reported out-of-bounds accesses
2026-08-10 11:42:16 +02:00
Robin Getz ccc140fbf7 vorlocalizer: fix leaked report message
Create and populate the VOR service report message as before, but delete it
when the feature message queue is not available.

The message is normally transferred to `m_msgQueueToFeature` for ownership,
but when the queue is null there is no owner and the allocated message leaked.

Coverity reported the leak as CID 652338 (`RESOURCE_LEAK`) while analyzing
`VorLocalizerWorker::rrNextTurn()`. Review of the surrounding message queue
usage confirmed that queued messages are owned by the queue, making the
missing-queue path the unhandled ownership case.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-08-09 19:53:20 -04:00
Robin Getz edd7092444 leansdr: fix pipewriter leaks in s2_deframer
Add a destructor to s2_deframer to release the pipewriter objects owned by
state_out and locktime_out.

opt_writer() allocates these pipewriters dynamically when the corresponding
output pipe is provided. Without a destructor, the objects were leaked when
s2_deframer was destroyed.

Coverity reported CTOR_DTOR_LEAK findings for state_out and locktime_out.
The existing leansdr code was reviewed and confirmed that other users of
opt_writer() explicitly delete the resulting pipewriters in their
destructors, so s2_deframer was missing the corresponding cleanup.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-08-09 19:45:52 -04:00
Robin Getz c29e491194 visa: close dynamically loaded VISA library
Unload the dynamically loaded VISA library when the VISA object is
destroyed and ensure radio astronomy VISA sessions are closed first.

Coverity reported a resource leak because `visaLibrary` was loaded with
`LoadLibrary`/`dlopen` but was never released. It also identified
uninitialized VISA function pointers and the library handle.

Initialize the remaining pointers, add platform-specific library cleanup,
and close all radio astronomy instrument sessions before releasing the
default VISA resource manager. The other VISA users were reviewed to
verify that their sessions and default resource managers are also closed
before their VISA objects are destroyed.

The library is only unloaded when no default resource manager session
remains active, avoiding unloading the VISA library while it is still in
use.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-08-09 19:35:41 -04:00
Robin Getz 4498bc62b2 udpsource: avoid leaking sample rate correction messages
Only allocate `MsgSampleRateCorrection` when a feedback message queue is
available.

The message was previously allocated before checking `m_autoRWBalance`
and `m_feedbackMessageQueue`. When either condition was false, the
message was never queued and its allocation was leaked.

Coverity CID 652413 reported a `RESOURCE_LEAK` after tracing the allocation
from `MsgSampleRateCorrection::create()` to the point where the local pointer
went out of scope without being transferred to the feedback queue.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-08-09 18:22:34 -04:00
Robin Getz 874fbbd65d dvbs2: fix leaked fec decoder writers
Free the bitcount and errcount pipe writers owned by s2_fecdec.

The writers are allocated by opt_writer() but were not released when
s2_fecdec was destroyed, causing the allocations to leak.

Coverity reported a CTOR_DTOR_LEAK in the s2_fecdec constructor,
identifying the allocations without corresponding destructor cleanup.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-08-09 18:10:33 -04:00
Robin Getz 9039a6ec9d chanalyzer: release FFT filter in RRCHelper destructor
Delete the FFT-based RRC filter when RRCHelper is destroyed.

RRCHelper allocates m_filterFFT but the destructor did not release it,
leaking the filter for every RRCHelper instance.

Coverity flagged the missing destructor cleanup as a CTOR_DTOR_LEAK.
The existing destructor already releases the FIR filter and sample buffer,
making the FFT filter cleanup part of the same ownership path.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-08-09 18:00:17 -04:00
Robin Getz 164a35b083 map: release aircraft state with map item
Add a destructor to ObjectMapItem to release its owned m_aircraftState.

ObjectMapItem allocates m_aircraftState when aircraft state is present,
but had no corresponding cleanup when the map item was destroyed.

Coverity reported the allocation as a constructor/destructor resource
leak.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-08-09 17:41:39 -04:00
Robin Getz c88cc7236a freqscanner: simplify frequency list handling
SWGFreqScannerSettings is newly created without a frequency list, so
there is no need to check for or copy into an existing list. Transfer
the newly created frequency list directly to the settings object.

The previous copy path left the newly allocated QList unowned when an
existing frequency list was present. This leaked the list because the
assignment copied its contents rather than transferring ownership.

This also resolves that resource leak identified by Coverity.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-08-09 17:33:58 -04:00
Robin Getz daea77ff23 dvbs2: fix leaked fec decoder writers
Coverity reported a resource leak for the bitcount and errcount writers
allocated by opt_writer(). Free them when the FEC decoder helper is
destroyed, matching the existing cleanup used by other LeanSDR components.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-08-09 17:14:06 -04:00
Edouard Griffiths 34215520ec Merge pull request #2864 from rgetz/rgetz-fix-uninitStructMember
fix uninit struct members
2026-08-09 20:02:04 +02:00
Edouard Griffiths 7abc5b3274 Merge pull request #2873 from srcejon/fixes
AIS, Packet and Pager demodulator improvements
2026-08-07 19:02:06 +02:00
Jon Beniston ed7903cb53 Copy missing settings. 2026-08-04 02:11:20 +01:00
Jon Beniston 0b71f7c746 Fix typo for useFileTime 2026-08-04 02:06:51 +01:00
Jon Beniston 02667a306f Improve AIS acquisition. 2026-08-04 01:54:38 +01:00
Jon Beniston afd178a3a4 Fix typo in useFileTime 2026-08-04 01:18:14 +01:00
Jon Beniston a67629c6da Avoid divide by zero, which can block demod 2026-08-04 01:18:01 +01:00
Jon Beniston 80ef2b2847 Improve packet detection 2026-08-04 01:17:24 +01:00
Jon Beniston 8ebdf56c19 Merge branch 'fixes' of https://github.com/srcejon/sdrangel into fixes 2026-08-03 14:06:15 +01:00
Jon Beniston 7e5d4f8d43 Packet Demod: Add MLSE demod and Chase decoding to improve performance. 2026-08-03 14:06:11 +01:00
srcejon 0d67de7847 Merge branch 'f4exb:master' into fixes 2026-08-03 13:42:07 +01:00
Jon Beniston db0a085096 Match values in resetToDefaults. 2026-08-03 01:44:35 +01:00
Robin Getz 99da6143dc ldpctool: fix uninitialized variable in vzero
Fix Coverity CID 652347 reporting an uninitialized scalar variable.
Replace XOR self-assignment with explicit zero initialization to
avoid reading uninitialized SIMD elements.

Modern compilers already optimize zero assignments to efficient
zeroing instructions where appropriate.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-08-02 20:39:53 -04:00
Robin Getz 4b1a910c12 modais: Initialize AIS modulator sample variable
Coverity reported an uninitialized value use in AISModSource::modulateSample().
The Gaussian filter output variable was only assigned during transmission,
but was used afterwards when the modulator was idle or waiting.

Initialize the variable to zero to match the idle sample behavior.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-08-02 20:39:53 -04:00
Robin Getz 7e96f9c139 simpleptt: Initialize rx to tx GPIO enable setting
Coverity reported an uninitialized m_rx2txGPIOEnable value when it was
used by SimplePTTGUI before settings were loaded. Initialize the setting
in resetToDefaults() to provide a defined default value.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-08-02 20:39:52 -04:00
Robin Getz bb01f58f28 demodvormc: Fix uninitialized variable phase in radial calculation
Coverity reported an uninitialized scalar use of varPhase when the
reference and variable Goertzel filters completed at different times.
Store the last valid variable phase and magnitude values to ensure the
radial calculation always uses initialized data.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-08-02 20:39:51 -04:00
Robin Getz d4f36753ed remotetcpinput: Avoid using uninitialized converter buffer
Coverity reported that an invalid sample size could leave the
conversion buffer uninitialized before it was passed to calcPower()
and the sample FIFO.

Return early when the sample conversion format is unsupported to
prevent processing invalid data.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-08-02 20:39:50 -04:00
Robin Getz ee24189bd2 modais: Initialize output bytes before HDLC bit packing
The HDLC encoder accumulated bits into m_bits using the |= operator
without first initializing the first byte. This resulted in an
uninitialized read of m_bits[0] when encoding the first bit of a
packet.

Initialize each output byte when writing its first bit, ensuring the
buffer contains a defined value before bits are OR'ed into it. This
also makes addBit() self-contained, eliminating the need for callers to
pre-initialize the current output byte.

Reported by Coverity.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-08-02 18:53:58 -04:00
Robin Getz 862e838b65 modais: Initialize remaining AISModSource members
Cppcheck reported several AISModSource members that were not initialized
by the constructor. Initialize the remaining scalar members in the
constructor initializer list to establish a well-defined initial state
and avoid undefined behavior if they are accessed before being assigned.

Reported by cppcheck.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-08-02 18:52:10 -04:00
Edouard Griffiths f6ed9b8cb3 Merge pull request #2868 from rgetz/rgetz-fix-copypaste
vorlocalizer: Fix round robin plan sorting comparator
2026-08-02 16:21:00 +02:00
Edouard Griffiths 744bb7e18d Merge pull request #2862 from rgetz/rgetz-fix-remaining-vlas
Remove remaining variable length arrays from demoddatv/ldpctool/generic.h
2026-08-02 05:30:31 +02:00
Edouard Griffiths f72133eee0 Merge pull request #2866 from rgetz/rgetz-fix-memsetClass
leansdr: Properly initialize QPSK hist buffer
2026-08-02 02:17:33 +02:00
Robin Getz c170e03ddd rtl-sdr: Fix out-of-bounds tuner name lookup
Validate the tuner type index before accessing the tuner name table.
The previous check allowed an index equal to names.size(), which could
result in an out-of-range QStringList access.

Use a local integer value for the enum conversion and ensure only valid
indices are used when looking up tuner names.

pointed out by cppcheck: Access out of bounds

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-08-01 19:52:09 -04:00
Robin Getz d122e69fba ldpctool: Remove VLAs from SumProductAlgorithm
Replace variable length arrays in SumProductAlgorithm::finalp() with a
std::vector buffers.

This removes reliance on compiler VLA extensions while preserving the
existing contiguous temporary buffer layout.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-08-01 19:48:46 -04:00
Robin Getz 85021508f1 ldpctool: Remove VLAs from LambdaMinAlgorithm
Replace variable length arrays in LambdaMinAlgorithm::finalp() with
std::vector storage.

Update nth_element() usage to operate on vector iterators while removing
the non-standard VLA usage.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-08-01 19:48:46 -04:00
Robin Getz e4561aeb77 ldpctool: Remove VLAs from LogDomainSPA
Replace variable length arrays in LogDomainSPA::finalp() with
std::vector buffers.

This removes reliance on compiler VLA extensions while preserving the
existing contiguous temporary buffer layout.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-08-01 19:48:46 -04:00
Robin Getz 7e26f86aa6 ldpctool: Remove VLAs from MinSumCAlgorithm<int8_t, FACTOR>
Replace the variable length temporary array in the int8_t FACTOR
specialization of MinSumCAlgorithm::finalp() with a std::vector buffer.

This removes reliance on compiler VLA extensions and uses standard C++
storage for the temporary reduction buffer.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-08-01 19:48:45 -04:00
Robin Getz 8ac0485e53 ldpctool: Remove VLAs from MinSumCAlgorithm<float, FACTOR>
Replace the variable length temporary array in the float FACTOR
specialization of MinSumCAlgorithm::finalp() with a std::vector buffer.

This removes reliance on compiler VLA extensions and uses standard C++
storage for the temporary reduction buffer.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-08-01 19:48:45 -04:00
Robin Getz 4ccc7a9bfd ldpctool: Remove VLA from MinSumCAlgorithm
Replace the variable length temporary array in MinSumCAlgorithm::finalp()
with a std::vector buffer.

This removes reliance on compiler VLA extensions and uses standard C++
storage for the temporary reduction buffer.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-08-01 19:48:44 -04:00
Robin Getz 4b3bf21418 ldpctool: Remove VLAs from OffsetMinSumAlgorithm<int8_t, FACTOR>
Replace variable length arrays in the int8_t FACTOR specialization of
OffsetMinSumAlgorithm::finalp() with a single std::vector scratch buffer.

This removes reliance on compiler VLA extensions while preserving the
existing contiguous temporary buffer layout.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-08-01 19:48:44 -04:00
Robin Getz 1f62875563 ldpctool: Remove VLAs from OffsetMinSumAlgorithm
Replace variable length arrays in OffsetMinSumAlgorithm::finalp() with a
std::vector buffers.

This removes reliance on compiler VLA extensions while preserving the
existing contiguous temporary buffer layout.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-08-01 19:48:44 -04:00
Robin Getz 6de853d3d1 ldpctool: Remove VLAs from MinSumAlgorithm<int8_t>
Replace variable length arrays in the int8_t specialization of
MinSumAlgorithm::finalp() with a single std::vector scratch buffer.

This removes reliance on compiler VLA extensions while preserving the
existing contiguous temporary buffer layout.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-08-01 19:48:43 -04:00
Robin Getz a1391d52a2 ldpctool: Remove VLAs from MinSumAlgorithm<float>
Replace variable length arrays in the float specialization of
MinSumAlgorithm::finalp() with std::vector storage.

This removes reliance on compiler VLA extensions and keeps the
temporary buffers managed by standard C++ containers.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-08-01 19:48:32 -04:00
Robin Getz edc4693448 rtl-sdr: Fix out-of-bounds access in gain selection
The gain change handler allowed an index equal to m_gains.size(),
which is outside the valid vector range. Reject invalid indices before
accessing the gain table to avoid undefined behavior.

found with cppcheck: Access out of bounds

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-08-01 19:40:15 -04:00
Robin Getz bef0b8184e vorlocalizer: Fix round robin plan sorting comparator
The channel count comparison in getChannelsByDevice() accidentally used
the first plan's channel count for both operands. This caused the comparator
to always treat the channel counts as equal and sort only by bandwidth.

Use the second plan's channel count when comparing RRTurnPlans so plans are
ordered correctly by number of channels before applying the bandwidth
tie-breaker.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-08-01 19:16:31 -04:00
Robin Getz 1a85082dac ldpctool: Remove VLAs from MinSumAlgorithm
Replace variable length arrays in MinSumAlgorithm::finalp() with a
std::vector buffers.

Variable length arrays are a compiler extension and are not part of
standard C++. The replacement preserves the existing contiguous memory
layout while avoiding non-standard stack allocations.

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-08-01 18:44:26 -04:00
Robin Getz fe22e92c29 leansdr: Properly initialize QPSK hist buffer
Replace raw memset() initialization of hist with C++ value initialization.
This avoids bypassing std::complex object initialization and ensures the
history buffer contains valid constructed objects when HIST_FLOAT is enabled.

The previous memset() relied on the in-memory representation of
std::complex<float> and could leave non-trivial objects improperly
initialized. While this typically behaved as expected with common
implementations, it was not valid C++ object initialization.

pointed out by cppcheck as:
    Using 'memset' on struct that contains a 'std::complex'

Signed-off-by: Robin Getz <rgetz503@gmail.com>
2026-08-01 17:26:51 -04:00
Jon Beniston 9a2d3f683a Update AIS docs to match latest UI. 2026-08-01 21:17:16 +01:00
Jon Beniston 2cb8091c54 Allow zooming in on chart and hiding of series. 2026-08-01 21:09:30 +01:00