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

native_sasl_client_session.cpp uses 'new' to create pointers

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 8.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Server Security
    • Fully Compatible
    • Security 2024-06-24, Security 2024-07-08, Security 2024-07-22, Security 2024-08-05, Security 2024-08-19, Security 2024-09-02
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      native_sasl_client_session.cpp has a number of function calls like this:

      _saslConversation.reset(new SaslPLAINClientConversation(this));
      

      'new' is considered bad form, because it creates objects which for a split second can leak if an exception is thrown. Instead, the code in this file should use make_unique. For example:

      _saslConversation = std::make_unique<SaslPLAINClientConversation>(this);
      

            Assignee:
            gabriel.marks@mongodb.com Gabriel Marks
            Reporter:
            spencer.jackson@mongodb.com Spencer Jackson
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: