Coverity analysis defect 155063: Different smart pointers managing same raw pointer

XMLWordPrintableJSON

    • Service Arch
    • ALL
    • v8.0
    • Workload Scheduling 2024-06-10
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Different smart pointers managing same raw pointer

      This may cause a crash, as different smart pointers may try to delete the raw pointer twice. Same raw pointer is used to initialize or reset two or more different smart pointers.
      /src/mongo/executor/connection_pool.cpp:907: MULTIPLE_INIT_SMART_PTRS 155063 Function "shared_ptr" assigns "conn" with "std::move(iter->second)".
      /src/mongo/executor/connection_pool.cpp:922: MULTIPLE_INIT_SMART_PTRS 155063 Function "get" returns a pointer managed by "conn".
      /src/mongo/executor/connection_pool.cpp:922: MULTIPLE_INIT_SMART_PTRS 155063 Assigning: "<temporary>" = "conn.get()".
      /src/mongo/executor/connection_pool.cpp:923: MULTIPLE_INIT_SMART_PTRS 155063 Function "operator =" assigns "mappedConn" with "std::move(conn)".
      /src/mongo/executor/connection_pool.cpp:927: MULTIPLE_INIT_SMART_PTRS 155063 Function "get" returns a pointer managed by "mappedConn".

              Assignee:
              Vojislav Stojkovic
              Reporter:
              Coverity Collector User
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: