[SERVER-32316] bson getOwned() unproper used Created: 14/Dec/17  Updated: 27/Oct/23  Resolved: 15/Dec/17

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: deyukong Assignee: Ramon Fernandez Marina
Resolution: Gone away Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Participants:

 Description   

https://github.com/mongodb/mongo/blob/53adeef7dbf5170a94f3e6d25425e8524fb9d062/src/mongo/db/s/collection_metadata.cpp#L104

getOwned() here does nothing to the object being called.
It only returns a new copy.
it is unproper used, and may lead to bad memory reference.
Perhaps metadata->_keyPattern = this->_keyPattern.getOwned() is what you need.



 Comments   
Comment by Ramon Fernandez Marina [ 15/Dec/17 ]

wolf_kdy, this usage is not a problem in practice for 3.0 and 3.2, and since it's no longer present in MongoDB 3.4.0 onwards I'm going to resolve this ticket.

Regards,
Ramón.

Comment by deyukong [ 14/Dec/17 ]

sorry, fix typo: unproper -> improper.

Generated at Thu Feb 08 04:29:53 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.