From bb573ef4c82a98595b2f7f0dc9480fd075523895 Mon Sep 17 00:00:00 2001 From: Dmitry Kalinkin Date: Sat, 18 May 2024 18:01:11 -0400 Subject: [PATCH] fix memory leak in VectorPDF --- include/SinglePDF.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/SinglePDF.h b/include/SinglePDF.h index 3d17238..5d42aa7 100644 --- a/include/SinglePDF.h +++ b/include/SinglePDF.h @@ -81,7 +81,11 @@ class UniformPDF: public SinglePDF { class VectorPDF: public TObject { public: VectorPDF() {}; - ~VectorPDF() {}; + ~VectorPDF() { + for(auto pdf : m_Members) { + delete pdf; + } + }; void AddMember(UniformPDF *pdf) { m_Members.push_back(pdf); }; unsigned GetWithinRangeCount(double x, double dx = 0.0) const {