Skip to content

Commit 7c4f932

Browse files
authored
prevent gGlobalMutex memory leak (#8585)
Fixes #8297
1 parent a8c5b37 commit 7c4f932

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

core/base/src/TROOT.cxx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,11 @@ TROOT::~TROOT()
865865

866866
// Turn-off the global mutex to avoid recreating mutexes that have
867867
// already been deleted during the destruction phase
868-
gGlobalMutex = nullptr;
868+
if (gGlobalMutex) {
869+
TVirtualMutex *m = gGlobalMutex;
870+
gGlobalMutex = nullptr;
871+
delete m;
872+
}
869873

870874
// Return when error occurred in TCling, i.e. when setup file(s) are
871875
// out of date

0 commit comments

Comments
 (0)