From: Georg Brandl Date: Tue, 13 May 2008 21:32:03 +0000 (+0000) Subject: Fix a refleak in the _warnings module. X-Git-Tag: v2.6b1~440 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9c5b51541cff55dacb899fb0711e675063ad0e96;p=thirdparty%2FPython%2Fcpython.git Fix a refleak in the _warnings module. --- diff --git a/Python/_warnings.c b/Python/_warnings.c index e75d4fd06a63..6603bf02f98c 100644 --- a/Python/_warnings.c +++ b/Python/_warnings.c @@ -408,8 +408,10 @@ warn_explicit(PyObject *category, PyObject *message, /* A proper implementation of warnings.showwarning() should have at least two default arguments. */ if ((defaults == NULL) || (PyTuple_Size(defaults) < 2)) { - if (PyErr_WarnEx(PyExc_DeprecationWarning, msg, 1) < 0) + if (PyErr_WarnEx(PyExc_DeprecationWarning, msg, 1) < 0) { + Py_DECREF(show_fxn); goto cleanup; + } } res = PyObject_CallFunctionObjArgs(show_fxn, message, category, filename, lineno_obj,