[SERVER-70232] Coverity analysis defect 122940: Using a moved object Created: 05/Oct/22  Updated: 29/Oct/23  Resolved: 04/Nov/22

Status: Closed
Project: Core Server
Component/s: Internal Code
Affects Version/s: None
Fix Version/s: 6.2.0-rc0

Type: Bug Priority: Major - P3
Reporter: Coverity Collector User Assignee: Sergi Mateo Bellido
Resolution: Fixed Votes: 0
Labels: coverity, neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File Screen Shot 2022-10-05 at 10.17.01 AM.png     PNG File Screen Shot 2022-10-05 at 10.21.26 AM.png    
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Sharding EMEA 2022-10-17, Sharding EMEA 2022-10-31, Sharding EMEA 2022-11-14
Participants:

 Description   

Using a moved object

Using a moved object may lead to an unexpected/undefined behavior. An object is used after it's moved.
/src/mongo/db/s/move_primary_source_manager.cpp:65: USE_AFTER_MOVE 122940 "fromShard" is moved (indicated by "std::move(fromShard)").
/src/mongo/db/s/move_primary_source_manager.cpp:67: USE_AFTER_MOVE 122940 "fromShard" is used after it has been already moved.



 Comments   
Comment by Githook User [ 04/Nov/22 ]

Author:

{'name': 'Sergi Mateo Bellido', 'email': 'sergi.mateo-bellido@mongodb.com', 'username': 'smateo'}

Message: SERVER-70232 Fixing variable usage after move
Branch: master
https://github.com/mongodb/mongo/commit/645b2ee20d5ae42be8fa390372a3314203d60646

Comment by Kyle Suarez [ 05/Oct/22 ]

Applies to both fromShard and toShard.

Generated at Thu Feb 08 06:15:38 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.