From: Traun Leyden Date: Fri, 16 Jan 2009 06:03:51 +0000 (+0000) Subject: Fix contributed by Stas Shtin to stop a resource leak, see MODLANG-95 X-Git-Tag: v1.0.3~695 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ef1632148d6778401de6931fb40219a4181589b4;p=thirdparty%2Ffreeswitch.git 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 --- 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: