From 3366ef5153f3af8fa4d83dfc40a4a4a4fad7557d Mon Sep 17 00:00:00 2001 From: Nitzan Mordechai Date: Sun, 9 Feb 2025 07:14:55 +0000 Subject: [PATCH] PyModule: Fix memory leak in load PyModule: Interpreter never ended - leaks Need to ending the interpreter to prevent valgrind leaks Signed-off-by: Nitzan Mordechai --- src/mgr/PyModule.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mgr/PyModule.cc b/src/mgr/PyModule.cc index e4b7095629909..fe33555280e14 100644 --- a/src/mgr/PyModule.cc +++ b/src/mgr/PyModule.cc @@ -708,6 +708,8 @@ PyModule::~PyModule() Gil gil(pMyThreadState, true); Py_XDECREF(pClass); Py_XDECREF(pStandbyClass); + Py_EndInterpreter(pMyThreadState.ts); + pMyThreadState.ts = nullptr; } } -- 2.47.3