From e0dc2df5fd83fca19b11a150e4c55ca48da2a21a Mon Sep 17 00:00:00 2001 From: cmargalejo Date: Thu, 16 Apr 2026 12:25:16 +0200 Subject: [PATCH] Fix memory leak in TRestRun::CloseFile Delete fInputEvent when closing the file to prevent a memory leak. Each call to CloseFile() was leaking the input event object,causing growing memory use when opening or closing multiple files. Fixes rest-for-physics/framework#519 --- source/framework/core/src/TRestRun.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/framework/core/src/TRestRun.cxx b/source/framework/core/src/TRestRun.cxx index af011ab61..b6596ac3d 100644 --- a/source/framework/core/src/TRestRun.cxx +++ b/source/framework/core/src/TRestRun.cxx @@ -1184,7 +1184,8 @@ void TRestRun::CloseFile() { } } } - + delete fInputEvent; + fInputEvent = nullptr; if (fOutputFile != nullptr) { fOutputFile->Write(0, TObject::kOverwrite); fOutputFile->Close();