From: W.C.A. Wijngaards Date: Fri, 2 Jul 2021 07:42:31 +0000 (+0200) Subject: - Fix #506: Python Module Seems to Leak Memory if it Experiences an X-Git-Tag: release-1.13.2rc1~43 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f62994f6ea59ba9ba41dfaefaabf62fe42e53d8b;p=thirdparty%2Funbound.git - Fix #506: Python Module Seems to Leak Memory if it Experiences an Unhandled Exception. --- diff --git a/doc/Changelog b/doc/Changelog index f4b1295b2..221b6c69b 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,3 +1,7 @@ +2 July 2021: Wouter + - Fix #506: Python Module Seems to Leak Memory if it Experiences an + Unhandled Exception. + 25 June 2021: Wouter - Fix up permissions on rpl data file in tests. - Fix testbound newline treatment in moment_read and tempfile write. diff --git a/pythonmod/pythonmod.c b/pythonmod/pythonmod.c index 0bbdeeb6b..4bea54e6a 100644 --- a/pythonmod/pythonmod.c +++ b/pythonmod/pythonmod.c @@ -245,6 +245,11 @@ cleanup: /* clear the exception, by not restoring it */ /* Restore the exception state */ /* PyErr_Restore(exc_typ, exc_val, exc_tb); */ + /* when using PyErr_Restore there is no need to Py_XDECREF for + * these 3 pointers. */ + Py_XDECREF(exc_typ); + Py_XDECREF(exc_val); + Py_XDECREF(exc_tb); } int pythonmod_init(struct module_env* env, int id)