[CXX-1725] Coverity analysis defect 105003: Dereference after null check Created: 04/Feb/19  Updated: 07/Jun/21  Resolved: 07/Jun/21

Status: Closed
Project: C++ Driver
Component/s: Testing
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor - P4
Reporter: Coverity Collector User Assignee: Unassigned
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Pointer is checked against null but then dereferenced anyway

Defect 105003 (STATIC_C)
Checker FORWARD_NULL (subcategory none)
File: /src/mongocxx/test/spec/change_stream.cpp
Function <unnamed>::____C_A_T_C_H____T_E_S_T____2()
/src/mongocxx/test/spec/change_stream.cpp, line: 165
Comparing "change_stream_tests_path" to null implies that "change_stream_tests_path" might be null.

        if (!change_stream_tests_path) {

/src/mongocxx/test/spec/change_stream.cpp, line: 169
Passing null pointer "change_stream_tests_path" to "basic_string", which dereferences it.

        std::string path = change_stream_tests_path;


Generated at Wed Feb 07 22:03:42 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.