Skip to content

Commit 147b2b2

Browse files
serhiy-storchakamiss-islington
authored andcommitted
Fix possible refleak in CodeType.replace() (pythonGH-106243)
A reference to c_code was leaked if PySys_Audit() failed. (cherry picked from commit 3c70d46) Co-authored-by: Serhiy Storchaka <[email protected]>
1 parent b952ebe commit 147b2b2

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

Objects/codeobject.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1943,6 +1943,7 @@ code_replace_impl(PyCodeObject *self, int co_argcount,
19431943
co_code, co_filename, co_name, co_argcount,
19441944
co_posonlyargcount, co_kwonlyargcount, co_nlocals,
19451945
co_stacksize, co_flags) < 0) {
1946+
Py_XDECREF(code);
19461947
return NULL;
19471948
}
19481949

0 commit comments

Comments
 (0)