diff options
author | Victor Stinner <vstinner@python.org> | 2021-01-08 14:01:38 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-08 14:01:38 (GMT) |
commit | e542d417b96077d04aec089505eacb990c9799ae (patch) | |
tree | ef81dfd04b71bd7f8772f8cee4f0b2d7e900d158 | |
parent | 07f2cee93f1b619650403981c455f47bfed8d818 (diff) | |
download | cpython-e542d417b96077d04aec089505eacb990c9799ae.zip cpython-e542d417b96077d04aec089505eacb990c9799ae.tar.gz cpython-e542d417b96077d04aec089505eacb990c9799ae.tar.bz2 |
bpo-42866: Fix refleak in CJK getcodec() (GH-24165)
Fix a reference leak in the getcodec() function of CJK codecs.
-rw-r--r-- | Misc/NEWS.d/next/Library/2021-01-08-10-57-21.bpo-42866.Y1DnrO.rst | 2 | ||||
-rw-r--r-- | Modules/cjkcodecs/cjkcodecs.h | 1 |
2 files changed, 3 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Library/2021-01-08-10-57-21.bpo-42866.Y1DnrO.rst b/Misc/NEWS.d/next/Library/2021-01-08-10-57-21.bpo-42866.Y1DnrO.rst new file mode 100644 index 0000000..3ea6cc2 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2021-01-08-10-57-21.bpo-42866.Y1DnrO.rst @@ -0,0 +1,2 @@ +Fix a reference leak in the ``getcodec()`` function of CJK codecs. Patch by +Victor Stinner. diff --git a/Modules/cjkcodecs/cjkcodecs.h b/Modules/cjkcodecs/cjkcodecs.h index 3b89bc9..ba8fad2 100644 --- a/Modules/cjkcodecs/cjkcodecs.h +++ b/Modules/cjkcodecs/cjkcodecs.h @@ -291,6 +291,7 @@ getcodec(PyObject *self, PyObject *encoding) r = PyObject_CallOneArg(cofunc, codecobj); Py_DECREF(codecobj); + Py_DECREF(cofunc); return r; } |