[Python-checkins] [3.12] Fix possible refleak in CodeType.replace() (GH-106243) (GH-106244)
serhiy-storchaka
webhook-mailer at python.org
Thu Jun 29 14:41:05 EDT 2023
https://github.com/python/cpython/commit/2405929c35239580aa0344f0e8fd31b87f9ccfe9
commit: 2405929c35239580aa0344f0e8fd31b87f9ccfe9
branch: 3.12
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: serhiy-storchaka <storchaka at gmail.com>
date: 2023-06-29T21:41:01+03:00
summary:
[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 at gmail.com>
files:
M Objects/codeobject.c
diff --git a/Objects/codeobject.c b/Objects/codeobject.c
index 9b54c6105811..d47ca731a10c 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;
}
More information about the Python-checkins
mailing list