mirror of
https://github.com/python/cpython.git
synced 2025-08-23 10:16:01 +00:00
bpo-42425: Fix possible leak in initialization of errmap for OSError (GH-23446)
This commit is contained in:
parent
0e62efc51e
commit
ed1007c0d7
1 changed files with 3 additions and 1 deletions
|
@ -2547,8 +2547,10 @@ _PyExc_Init(PyThreadState *tstate)
|
|||
do { \
|
||||
PyObject *_code = PyLong_FromLong(CODE); \
|
||||
assert(_PyObject_RealIsSubclass(PyExc_ ## TYPE, PyExc_OSError)); \
|
||||
if (!_code || PyDict_SetItem(state->errnomap, _code, PyExc_ ## TYPE)) \
|
||||
if (!_code || PyDict_SetItem(state->errnomap, _code, PyExc_ ## TYPE)) { \
|
||||
Py_XDECREF(_code); \
|
||||
return _PyStatus_ERR("errmap insertion problem."); \
|
||||
} \
|
||||
Py_DECREF(_code); \
|
||||
} while (0)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue