[SERVER-64475] Coverity analysis defect 121877: Copy without assign Created: 14/Mar/22  Updated: 29/Oct/23  Resolved: 01/Apr/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 6.0.0-rc0

Type: Bug Priority: Minor - P4
Reporter: Coverity Collector User Assignee: Kaloian Manassiev
Resolution: Fixed Votes: 0
Labels: coverity
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File Screen Shot 2022-03-14 at 11.25.34 AM.png    
Issue Links:
Duplicate
is duplicated by SERVER-64477 Coverity analysis defect 121881: Copy... Closed
Problem/Incident
is caused by SERVER-64057 Implement a scoped object for setting... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Sharding EMEA 2022-04-04
Participants:
Linked BF Score: 136

 Description   

Copy without assign

This class has a user-defined copy constructor but no user-defined assignment operator. If the copy constructor is necessary to manage owned resources then a corresponding assignment operator is usually required. If an object of this type is assigned memory leaks and/or use-after-free errors may occur. Note that a compiler-generated assignment operator will perform only a bit-wise copy for any fields that do not have their own assignment operators defined. Class has user-written copy constructor but no user-written assignment operator
/src/mongo/db/s/operation_sharding_state.h:183: COPY_WITHOUT_ASSIGN 121877 Class "mongo::OperationShardingState::ShardVersionTracker" has a user-written copy constructor "mongo::OperationShardingState::ShardVersionTracker::ShardVersionTracker(mongo::OperationShardingState::ShardVersionTracker const &) =delete" but no corresponding user-written assignment operator.
/src/mongo/db/s/operation_sharding_state.h:186: COPY_WITHOUT_ASSIGN 121877 User-written copy constructor.



 Comments   
Comment by Githook User [ 13/Apr/22 ]

Author:

{'name': 'Kaloian Manassiev', 'email': 'kaloian.manassiev@mongodb.com', 'username': 'kaloianm'}

Message: SERVER-64475 Restore the scope of a wrongly moved CollectionDescription
Branch: master
https://github.com/mongodb/mongo/commit/1f4d545a7c2903249d1f4269f03f31bf8f1dff5d

Comment by Githook User [ 01/Apr/22 ]

Author:

{'name': 'Kaloian Manassiev', 'email': 'kaloian.manassiev@mongodb.com', 'username': 'kaloianm'}

Message: SERVER-64475 Change isOperationVersioned to isComingFromRouter
Branch: master
https://github.com/mongodb/mongo/commit/c829cc9b78f8beffebf272b3157f557bd475571b

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