Skip to content

Commit ed1007c

Browse files
bpo-42425: Fix possible leak in initialization of errmap for OSError (GH-23446)
1 parent 0e62efc commit ed1007c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Objects/exceptions.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2547,8 +2547,10 @@ _PyExc_Init(PyThreadState *tstate)
25472547
do { \
25482548
PyObject *_code = PyLong_FromLong(CODE); \
25492549
assert(_PyObject_RealIsSubclass(PyExc_ ## TYPE, PyExc_OSError)); \
2550-
if (!_code || PyDict_SetItem(state->errnomap, _code, PyExc_ ## TYPE)) \
2550+
if (!_code || PyDict_SetItem(state->errnomap, _code, PyExc_ ## TYPE)) { \
2551+
Py_XDECREF(_code); \
25512552
return _PyStatus_ERR("errmap insertion problem."); \
2553+
} \
25522554
Py_DECREF(_code); \
25532555
} while (0)
25542556

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy