]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix some of the remaining test_capi refleaks
authorAntoine Pitrou <solipsis@pitrou.net>
Wed, 18 Jan 2012 20:29:05 +0000 (21:29 +0100)
committerAntoine Pitrou <solipsis@pitrou.net>
Wed, 18 Jan 2012 20:29:05 +0000 (21:29 +0100)
Objects/exceptions.c

index ab71605f495c72b5153d6a29b6c394cffb432f23..fc299f599e6fdc09f8b08859eac932e3835c20e0 100644 (file)
@@ -2225,6 +2225,7 @@ PyObject *PyExc_RecursionErrorInst = NULL;
         Py_FatalError("Module dictionary insertion problem.");
 
 #define INIT_ALIAS(NAME, TYPE) Py_INCREF(PyExc_ ## TYPE); \
+    Py_XDECREF(PyExc_ ## NAME); \
     PyExc_ ## NAME = PyExc_ ## TYPE; \
     if (PyDict_SetItemString(bdict, # NAME, PyExc_ ## NAME)) \
         Py_FatalError("Module dictionary insertion problem.");
@@ -2234,6 +2235,7 @@ PyObject *PyExc_RecursionErrorInst = NULL;
     assert(_PyObject_RealIsSubclass(PyExc_ ## TYPE, PyExc_OSError)); \
     if (!_code || PyDict_SetItem(errnomap, _code, PyExc_ ## TYPE)) \
         Py_FatalError("errmap insertion problem."); \
+    Py_DECREF(_code); \
     }
 
 #ifdef MS_WINDOWS