[SERVER-18736] Coverity analysis defect 72719: Dereference null return value Created: 29/May/15  Updated: 05/Feb/16  Resolved: 24/Jun/15

Status: Closed
Project: Core Server
Component/s: Testing Infrastructure
Affects Version/s: None
Fix Version/s: 3.1.5

Type: Bug Priority: Major - P3
Reporter: Coverity Collector User Assignee: Daniel Alabi
Resolution: Done Votes: 0
Labels: coverity
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Sharding 5 06/26/16
Participants:

 Description   

Return value of function which returns null is dereferenced without checking

Defect 72719 (STATIC_C)
Checker NULL_RETURNS (subcategory none)
File: /src/mongo/client/replica_set_monitor_read_preference_test.cpp
Function <unnamed>::selectNode(const std::vector<mongo::ReplicaSetMonitor::SetState::Node, std::allocator<mongo::ReplicaSetMonitor::SetState::Node>> &, mongo::ReadPreference, const mongo::TagSet &, int, bool *)
/src/mongo/client/replica_set_monitor_read_preference_test.cpp, line: 67
Dereferencing a null pointer "set.findNode(out)".

                *isPrimarySelected = !out.empty() && set.findNode(out)->isMaster;



 Comments   
Comment by Githook User [ 24/Jun/15 ]

Author:

{u'username': u'alabid', u'name': u'Daniel Alabi', u'email': u'alabidan@gmail.com'}

Message: SERVER-18736 Coverity fix: check return value of SetState::Node::findNode
Branch: master
https://github.com/mongodb/mongo/commit/54d3b763d1ac9aded2048707000729857e71b5a6

Generated at Thu Feb 08 03:48:35 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.