[SERVER-11560] Memory leak in md5sumFile shell utility method (coverity auto-detected) Created: 04/Nov/13  Updated: 11/Jul/16  Resolved: 26/Nov/13

Status: Closed
Project: Core Server
Component/s: Shell
Affects Version/s: None
Fix Version/s: 2.4.10, 2.5.5

Type: Bug Priority: Major - P3
Reporter: auto Assignee: Shaun Verch
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Participants:

 Description   
Issue Status as of March 28, 2014

ISSUE SUMMARY
The md5sumFile shell utility method contains a bug that leaked memory due to not closing the file descriptor.

USER IMPACT
No server impact, but could potentially cause memory exhaustion on the client if repeated often enough.

SOLUTION
Close the file handle when the file cannot be opened before exiting the block.

WORKAROUNDS
None

AFFECTED VERSIONS
All recent production releases up to version 2.4.9 are affected.

PATCHES
The fix is included in the 2.4.10 production release and the 2.5.5 development release, which will evolve into the 2.6.0 production release.

Original Description

A new defect has been detected and assigned to sverch in Coverity Connect http://coverity.mongodb.com//sourcebrowser.htm?projectId=10001#mergedDefectId=10177
The defect was flagged by checker RESOURCE_LEAK in
file /src/mongo/shell/shell_utils_extended.cpp
function mongo::shell_utils::md5sumFile(const mongo::BSONObj &, void *)
and this ticket was created by matt.kangas@10gen.com



 Comments   
Comment by Githook User [ 09/Mar/14 ]

Author:

{u'username': u'Zarkantho', u'name': u'Shaun Verch', u'email': u'shaun.verch@10gen.com'}

Message: SERVER-11560 Close file handle in shell util
Branch: v2.4
https://github.com/mongodb/mongo/commit/4c16a61826d96639b0542de0dbbdd9c5eb3fec24

Comment by Githook User [ 26/Nov/13 ]

Author:

{u'username': u'Zarkantho', u'name': u'Shaun Verch', u'email': u'shaun.verch@10gen.com'}

Message: SERVER-11560 Close file handle in shell util
Branch: master
https://github.com/mongodb/mongo/commit/727ee88a88ce95f041ae53b9c11336424b8850e2

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