Coverity analysis defect 10181: Resource leak

XMLWordPrintableJSON

    • Fully Compatible
    • ALL
    • Dev Tools 2019-11-04
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Leak of memory or pointers to system resources

      Defect 10181 (STATIC_C)
      Checker RESOURCE_LEAK (subcategory none)
      File: /src/mongo/shell/linenoise.cpp
      Function InputBuffer::incrementalHistorySearch(PromptBase &, int)
      /src/mongo/shell/linenoise.cpp, line: 1935
      Storage is returned from allocation function "operator new[]".

                      activeHistoryLine = new UChar32[bufferSize];
      

      /src/mongo/shell/linenoise.cpp, line: 1935
      Assigning: "activeHistoryLine" = storage returned from "new linenoise_utf8::UChar32[bufferSize]".

                      activeHistoryLine = new UChar32[bufferSize];
      

      /src/mongo/shell/linenoise.cpp, line: 1883
      Overwriting "activeHistoryLine" in "activeHistoryLine = new linenoise_utf8::UChar32[bufferSize]" leaks the storage that "activeHistoryLine" points to.

                      activeHistoryLine = new UChar32[bufferSize];
      

            Assignee:
            Billy Donahue
            Reporter:
            Coverity Collector User
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: