Skip to content

Commit 3c70d46

Browse files
Fix possible refleak in CodeType.replace() (GH-106243)
A reference to c_code was leaked if PySys_Audit() failed.
1 parent fb0d9b9 commit 3c70d46

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
@@ -2035,6 +2035,7 @@ code_replace_impl(PyCodeObject *self, int co_argcount,
20352035
co_code, co_filename, co_name, co_argcount,
20362036
co_posonlyargcount, co_kwonlyargcount, co_nlocals,
20372037
co_stacksize, co_flags) < 0) {
2038+
Py_XDECREF(code);
20382039
return NULL;
20392040
}
20402041

0 commit comments

Comments
 (0)