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

A memory leak per line of typed text in the shell

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 2.1.0
    • Affects Version/s: None
    • Component/s: Shell
    • Labels:
      None
    • Environment:
      Any
    • ALL

      The linenoise() routine that shell/dbshell.cpp calls to collect typed input from the user uses strdup() to make a copy of its internal buffer's contents and returns the pointer from strdup(). The calling code acts as if this is just a pointer it can play with and not a block of memory that it now owns. It never calls free() on it. After ten lines of typing, ten small buffers have been leaked. The buffers are the minimum size required to hold the text (e.g. "a=7" is 4 bytes) so the shell would need to have a novella typed into it for this to even begin to matter. This is user input only, displayed data does not leak.

            Assignee:
            tad Tad Marshall
            Reporter:
            tad Tad Marshall
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: