[SERVER-67764] Coverity analysis defect 122495: Resource leak in object Created: 02/Jul/22  Updated: 29/Oct/23  Resolved: 12/Jul/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 6.1.0-rc0

Type: Bug Priority: Major - P3
Reporter: Coverity Collector User Assignee: Billy Donahue
Resolution: Fixed Votes: 0
Labels: coverity
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-65987 ServerStatusMetric API refresh Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Service Arch 2022-07-11
Participants:

 Description   

Resource leak in object

The memory will not be reclaimed by the destructor, and it cannot be reused until the process terminates. Constructor allocates memory but destructor does not free it
/src/mongo/db/commands/server_status_metric.cpp:56: CTOR_DTOR_LEAK 122495 Allocating memory by calling "new std::mutex".
/src/mongo/db/commands/server_status_metric.cpp:56: CTOR_DTOR_LEAK 122495 Assigning: "this->mutex" = "new std::mutex".
/src/mongo/db/commands/server_status_metric.cpp:56: CTOR_DTOR_LEAK 122495 The constructor allocates field "mutex" of "mongo::globalMetricTree(bool)::[unnamed type of 'instance']" but there is no destructor.



 Comments   
Comment by Githook User [ 12/Jul/22 ]

Author:

{'name': 'Billy Donahue', 'email': 'billy.donahue@mongodb.com', 'username': 'BillyDonahue'}

Message: SERVER-67764 simplify globalMetricTree singleton to fix coverity memory leak
Branch: master
https://github.com/mongodb/mongo/commit/eb0658df5c647ee2af5b5b4eec90f4b06a471eae

Comment by Billy Donahue [ 12/Jul/22 ]

commit failed actually. trying again

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