[3.8] bpo-42425: Fix possible leak in initialization of errmap for OSError (GH-23446). (GH-24025)
(cherry picked from commit ed1007c0d7
)
This commit is contained in:
parent
e3a9adba32
commit
1a544e1dcf
|
@ -2518,8 +2518,10 @@ _PyExc_Init(void)
|
||||||
do { \
|
do { \
|
||||||
PyObject *_code = PyLong_FromLong(CODE); \
|
PyObject *_code = PyLong_FromLong(CODE); \
|
||||||
assert(_PyObject_RealIsSubclass(PyExc_ ## TYPE, PyExc_OSError)); \
|
assert(_PyObject_RealIsSubclass(PyExc_ ## TYPE, PyExc_OSError)); \
|
||||||
if (!_code || PyDict_SetItem(errnomap, _code, PyExc_ ## TYPE)) \
|
if (!_code || PyDict_SetItem(errnomap, _code, PyExc_ ## TYPE)) { \
|
||||||
|
Py_XDECREF(_code); \
|
||||||
return _PyStatus_ERR("errmap insertion problem."); \
|
return _PyStatus_ERR("errmap insertion problem."); \
|
||||||
|
} \
|
||||||
Py_DECREF(_code); \
|
Py_DECREF(_code); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue