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

Coverity analysis defect 111241: Resource leak

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Networking
    • Labels:
    • ALL
    • Security 2019-02-25

      Leak of memory or pointers to system resources

      Defect 111241 (STATIC_C)
      Checker RESOURCE_LEAK (subcategory none)
      File: /src/mongo/util/net/hostname_canonicalization.cpp
      Function mongo::getHostFQDNs(std::basic_string<char, std::char_traits<char>, std::allocator<char>>, mongo::HostnameCanonicalizationMode)
      /src/mongo/util/net/hostname_canonicalization.cpp, line: 92
      "shim_getaddrinfo" allocates memory that is stored into "info". (The function pointer resolves to "getaddrinfo".)

              if ((err = shim_getaddrinfo(nativeHostName.c_str(), nullptr, &hints, &info)) != 0) {
      

      /src/mongo/util/net/hostname_canonicalization.cpp, line: 101
      Variable "info" going out of scope leaks the storage it points to.

                  return results;
      

            Assignee:
            jonathan.reams@mongodb.com Jonathan Reams
            Reporter:
            xgen-internal-coverity Coverity Collector User
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: