summaryrefslogtreecommitdiffstats
path: root/Objects/codeobject.c
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2023-06-29 18:41:01 (GMT)
committerGitHub <noreply@github.com>2023-06-29 18:41:01 (GMT)
commit2405929c35239580aa0344f0e8fd31b87f9ccfe9 (patch)
tree894bb8d3cb3769e2ec5cde368a70c2d2d34eee9b /Objects/codeobject.c
parentc9b9555650fee56a2fcb66c1db25e2b57f71a5d9 (diff)
downloadcpython-2405929c35239580aa0344f0e8fd31b87f9ccfe9.zip
cpython-2405929c35239580aa0344f0e8fd31b87f9ccfe9.tar.gz
cpython-2405929c35239580aa0344f0e8fd31b87f9ccfe9.tar.bz2
[3.12] Fix possible refleak in CodeType.replace() (GH-106243) (GH-106244)
Fix possible refleak in CodeType.replace() (GH-106243) A reference to c_code was leaked if PySys_Audit() failed. (cherry picked from commit 3c70d467c148875f2ce17bacab8909ecc3e9fc1d) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Diffstat (limited to 'Objects/codeobject.c')
-rw-r--r--Objects/codeobject.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/Objects/codeobject.c b/Objects/codeobject.c
index 9b54c61..d47ca73 100644
--- a/Objects/codeobject.c
+++ b/Objects/codeobject.c
@@ -2030,6 +2030,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;
}