[SERVER-36575] Coverity analysis defect 104960: Dereference null return value Created: 10/Aug/18  Updated: 06/Dec/22  Resolved: 10/Aug/18

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

Type: Bug Priority: Major - P3
Reporter: Coverity Collector User Assignee: [DO NOT USE] Backlog - Sharding Team
Resolution: Won't Fix Votes: 0
Labels: coverity
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by SERVER-36574 Coverity analysis defect 104958: Dere... Closed
Assigned Teams:
Sharding
Operating System: ALL
Participants:

 Description   

Return value of function which returns null is dereferenced without checking

Defect 104960 (STATIC_C)
Checker NULL_RETURNS (subcategory none)
File: /src/mongo/db/operation_context_session_mongod.cpp
Function mongo::OperationContextSessionMongod::OperationContextSessionMongod(mongo::OperationContext *, bool, boost::optional<bool>, boost::optional<bool>)
/src/mongo/db/operation_context_session_mongod.cpp, line: 48
Assigning: "txnParticipant" = null return value from "get".

            auto txnParticipant = TransactionParticipant::get(opCtx);



 Comments   
Comment by Randolph Tan [ 10/Aug/18 ]

Marked as ignored in coverity with comments: "if (opCtx->getTxnNumber()) implies session will be attached to opCtx, txnParticipant always exists when Session exists"

Comment by Esha Maharishi (Inactive) [ 10/Aug/18 ]

CC renctan

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