# 
# old_revision [734d5f45e00c6d9d6072160562ea351d3e2ef238]
# 
# patch "src/pl/plpython/plpython.c"
#  from [103ec857e125a1ca082966ee70f7a2d7dbc19928]
#    to [97efa8b35c7e6431677f738015f7f5bf86089791]
# 
============================================================
--- src/pl/plpython/plpython.c	103ec857e125a1ca082966ee70f7a2d7dbc19928
+++ src/pl/plpython/plpython.c	97efa8b35c7e6431677f738015f7f5bf86089791
@@ -2516,6 +2516,7 @@
 	}
 
 	PyErr_NormalizeException(&e, &v, &tb);
+	Py_XDECREF(tb);
 
 	eob = PyObject_Str(e);
 	if (v && ((vob = PyObject_Str(v)) != NULL))
@@ -2534,9 +2535,10 @@
 
 	Py_DECREF(eob);
 	Py_XDECREF(vob);
+	Py_XDECREF(v);
 
 	/*
-	 * intuit an appropriate error level for based on the exception type
+	 * intuit an appropriate error level based on the exception type
 	 */
 	if (PLy_exc_error && PyErr_GivenExceptionMatches(e, PLy_exc_error))
 		*xlevel = ERROR;
@@ -2545,6 +2547,7 @@
 	else
 		*xlevel = ERROR;
 
+	Py_DECREF(e);
 	return xstr;
 }
 
