aboutsummaryrefslogtreecommitdiff
path: root/src/pl/plpython/plpython.c
diff options
context:
space:
mode:
authorNeil Conway <neilc@samurai.com>2006-02-20 20:10:45 +0000
committerNeil Conway <neilc@samurai.com>2006-02-20 20:10:45 +0000
commitbf578aedca91ac3011e22b04e59243abc73f64f6 (patch)
treeba3e8a3b67a7f6739a2ecc9a7acca00ac694c385 /src/pl/plpython/plpython.c
parentac2172d6f6fa76dd93ec21d6e1749b9dd091fe13 (diff)
downloadpostgresql-bf578aedca91ac3011e22b04e59243abc73f64f6.tar.gz
postgresql-bf578aedca91ac3011e22b04e59243abc73f64f6.zip
Fix three Python reference leaks in PLy_traceback(). This would result
in leaking memory when invoking a PL/Python procedure that raises an exception. Unfortunately this still leaks memory, but at least the largest leak has been plugged. This patch also fixes a reference counting mistake in PLy_modify_tuple() for 8.0, 8.1 and HEAD: we don't actually own a reference to `platt', so we shouldn't Py_DECREF() it.
Diffstat (limited to 'src/pl/plpython/plpython.c')
-rw-r--r--src/pl/plpython/plpython.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/pl/plpython/plpython.c b/src/pl/plpython/plpython.c
index 80b60a4777f..e811776599e 100644
--- a/src/pl/plpython/plpython.c
+++ b/src/pl/plpython/plpython.c
@@ -29,7 +29,7 @@
* MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/pl/plpython/plpython.c,v 1.41.2.2 2005/09/25 03:18:16 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/pl/plpython/plpython.c,v 1.41.2.3 2006/02/20 20:10:45 neilc Exp $
*
*********************************************************************
*/
@@ -1121,7 +1121,7 @@ PLy_procedure_create(FunctionCallInfo fcinfo, Oid tgreloid,
}
/*
- * now get information required for input conversion of the procedures
+ * now get information required for input conversion of the procedure's
* arguments.
*/
proc->nargs = fcinfo->nargs;
@@ -2695,6 +2695,7 @@ PLy_traceback(int *xlevel)
}
PyErr_NormalizeException(&e, &v, &tb);
+ Py_XDECREF(tb);
eob = PyObject_Str(e);
if ((v) && ((vob = PyObject_Str(v)) != NULL))
@@ -2713,9 +2714,10 @@ PLy_traceback(int *xlevel)
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;
@@ -2724,6 +2726,7 @@ PLy_traceback(int *xlevel)
else
*xlevel = ERROR;
+ Py_DECREF(e);
leave();
return xstr;