From 3c70d467c148875f2ce17bacab8909ecc3e9fc1d Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Thu, 29 Jun 2023 17:22:15 +0300 Subject: Fix possible refleak in CodeType.replace() (GH-106243) A reference to c_code was leaked if PySys_Audit() failed. --- Objects/codeobject.c | 1 + 1 file changed, 1 insertion(+) diff --git a/Objects/codeobject.c b/Objects/codeobject.c index a53584c..d2670c7 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; } -- cgit v0.12