aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2023-06-29 17:22:15 +0300
committerGitHub <noreply@github.com>2023-06-29 17:22:15 +0300
commit3c70d467c148875f2ce17bacab8909ecc3e9fc1d (patch)
tree214a6f636b8914299e0ce5992a8ef540fe32b8ce
parentfb0d9b9ac1ec3ea13fae8b8ef6a4f0a5a80482b3 (diff)
downloadcpython-3c70d467c148875f2ce17bacab8909ecc3e9fc1d.tar.gz
cpython-3c70d467c148875f2ce17bacab8909ecc3e9fc1d.zip
Fix possible refleak in CodeType.replace() (GH-106243)
A reference to c_code was leaked if PySys_Audit() failed.
-rw-r--r--Objects/codeobject.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/Objects/codeobject.c b/Objects/codeobject.c
index a53584c4795..d2670c71caa 100644
--- a/Objects/codeobject.c
+++ b/Objects/codeobject.c
@@ -2035,6 +2035,7 @@ code_replace_impl(PyCodeObject *self, int co_argcount,
co_code, co_filename, co_name, co_argcount,
co_posonlyargcount, co_kwonlyargcount, co_nlocals,
co_stacksize, co_flags) < 0) {
+ Py_XDECREF(code);
return NULL;
}