From 74c8c665182cfdbca3bdd7c0f4040470ea05371a Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Fri, 7 Aug 2026 19:37:21 -0400 Subject: [PATCH] plutosdr: use move semantics in device scan Transfer ownership of the temporary fixed URI into DeviceScan and the newly created shared pointer into the scan list instead of copying them. Neither object is used after the transfer, so moving avoids unnecessary string and shared_ptr copies and makes the intended ownership transfer explicit. This fixes Coverity CIDs 652268 and 652358 (COPY_INSTEAD_OF_MOVE). Signed-off-by: Robin Getz --- devices/plutosdr/deviceplutosdrscan.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/devices/plutosdr/deviceplutosdrscan.cpp b/devices/plutosdr/deviceplutosdrscan.cpp index 68e94cc3f..8999435dc 100644 --- a/devices/plutosdr/deviceplutosdrscan.cpp +++ b/devices/plutosdr/deviceplutosdrscan.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include @@ -82,9 +83,9 @@ void DevicePlutoSDRScan::scan() DeviceScan({ std::string(description), std::string("TBD"), - fixedUri + std::move(fixedUri) })); - m_scans.push_back(dev_scan); + m_scans.push_back(std::move(dev_scan)); m_urilMap[m_scans.back()->m_uri] = m_scans.back(); std::regex desc_regex(".*serial=(.+)");