[SERVER-13965] errnoWithDescription can leak memory on Windows Created: 16/May/14  Updated: 13/Aug/16  Resolved: 20/Jul/16

Status: Closed
Project: Core Server
Component/s: Internal Code
Affects Version/s: None
Fix Version/s: 3.3.11

Type: Bug Priority: Major - P3
Reporter: Eric Milkie Assignee: Waley Chen
Resolution: Done Votes: 0
Labels: neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Operating System: ALL
Steps To Reproduce:

        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);
        }

Sprint: Platforms 18 (08/05/16)
Participants:

 Description   

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



 Comments   
Comment by Githook User [ 20/Jul/16 ]

Author:

{u'username': u'WaleyChen', u'name': u'Waley Chen', u'email': u'waleycz@gmail.com'}

Message: SERVER-13965 errnoWithDescription can leak memory on Windows
Branch: master
https://github.com/mongodb/mongo/commit/279b9f86538f0ac09b1bc40218cd8f7084e7df09

Generated at Thu Feb 08 03:33:26 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.