From ef1632148d6778401de6931fb40219a4181589b4 Mon Sep 17 00:00:00 2001 From: Traun Leyden Date: Fri, 16 Jan 2009 06:03:51 +0000 Subject: [PATCH] Fix contributed by Stas Shtin to stop a resource leak, see MODLANG-95 git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@11254 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/languages/mod_python/mod_python.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mod/languages/mod_python/mod_python.c b/src/mod/languages/mod_python/mod_python.c index 1c5b1c05d6..1853ceb773 100644 --- a/src/mod/languages/mod_python/mod_python.c +++ b/src/mod/languages/mod_python/mod_python.c @@ -198,7 +198,10 @@ static void eval_some_python(const char *funcname, char *args, switch_core_sessi } if (tstate) { + // thread state must be cleared explicitly or we'll get memory leaks + PyThreadState_Clear(tstate); PyEval_ReleaseThread(tstate); + PyThreadState_Delete(tstate); } done: