mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-08-04 18:06:22 -04:00
0928de3b7b
Fix cppcheck warning:
Using iterator to member container 'm_sinkBuddies' that may be invalid
clearBuddiesLists() was iterating directly over m_sourceBuddies and
m_sinkBuddies while calling removeBuddy(), which modifies the buddy
relationship lists. This could invalidate the active iterator and result in
undefined behavior.
The issue could lead to intermittent failures during buddy cleanup operations,
such as device removal, device reload, or application shutdown, depending on
container state and timing.
Iterate over copies of the buddy lists so that removing relationships does not
affect the iterators used for traversal.
Signed-off-by: Robin Getz <rgetz503@gmail.com>