Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-89315

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

    • Service Arch
    • Fully Compatible
    • ALL
    • v8.0
    • Service Arch 2024-05-13

      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 147940 Function "shared_ptr" assigns "conn" with "std::move(iter->second)".
      /src/mongo/executor/connection_pool.cpp:920: MULTIPLE_INIT_SMART_PTRS 147940 Function "get" returns a pointer managed by "conn".
      /src/mongo/executor/connection_pool.cpp:920: MULTIPLE_INIT_SMART_PTRS 147940 Assigning: "connPtr" = "conn.get()".
      /src/mongo/executor/connection_pool.cpp:925: MULTIPLE_INIT_SMART_PTRS 147940 Function "operator =" assigns "this->_checkedOutPool[connPtr]" with "std::move(conn)".

            Assignee:
            ronald.steinke@mongodb.com Ronald Steinke
            Reporter:
            xgen-internal-coverity Coverity Collector User
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: