aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2021-01-01 19:40:11 +0200
committerGitHub <noreply@github.com>2021-01-01 19:40:11 +0200
commit1a544e1dcf8e0880ee35ce78a7f90fc4e5c98c4f (patch)
tree72194344e6e00555ba59a14da2b92a18e7b89324 /Objects
parent[3.8] bpo-42759: Fix equality comparison of Variable and Font in Tkinter (GH-... (diff)
downloadcpython-1a544e1dcf8e0880ee35ce78a7f90fc4e5c98c4f.tar.gz
cpython-1a544e1dcf8e0880ee35ce78a7f90fc4e5c98c4f.tar.bz2
cpython-1a544e1dcf8e0880ee35ce78a7f90fc4e5c98c4f.zip
[3.8] bpo-42425: Fix possible leak in initialization of errmap for OSError (GH-23446). (GH-24025)
(cherry picked from commit ed1007c0d74e658d1e6c9b51b12ce7501eb8cbf9)
Diffstat (limited to 'Objects')
-rw-r--r--Objects/exceptions.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Objects/exceptions.c b/Objects/exceptions.c
index 8bcf76ff860..d22ed6f039a 100644
--- a/Objects/exceptions.c
+++ b/Objects/exceptions.c
@@ -2518,8 +2518,10 @@ _PyExc_Init(void)
do { \
PyObject *_code = PyLong_FromLong(CODE); \
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."); \
+ } \
Py_DECREF(_code); \
} while (0)