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

errnoWithDescription can leak memory on Windows

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.3.11
    • Affects Version/s: None
    • Component/s: Internal Code
    • Labels:
    • Fully Compatible
    • ALL
    • Hide
              if( errorText ) {
                  string x = toUtf8String(errorText);
                  for( string::iterator i = x.begin(); i != x.end(); i++ ) {
                      if( *i == '\n' || *i == '\r' )
                          break;
                      s << *i;
                  }
                  LocalFree(errorText);
              }
      
      Show
      if ( errorText ) { string x = toUtf8String(errorText); for ( string::iterator i = x.begin(); i != x.end(); i++ ) { if ( *i == '\n' || *i == '\r' ) break ; s << *i; } LocalFree(errorText); }
    • Platforms 18 (08/05/16)

      Since toUtf8String() can throw, it's possible to miss calling LocalFree(errorText). This should probably be placed in an ON_BLOCK_EXIT.

            Assignee:
            waley.chen Waley Chen
            Reporter:
            milkie@mongodb.com Eric Milkie
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: