Skip to content

Commit 2405929

Browse files
[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 3c70d46) Co-authored-by: Serhiy Storchaka <[email protected]>
1 parent c9b9555 commit 2405929

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
@@ -2030,6 +2030,7 @@ code_replace_impl(PyCodeObject *self, int co_argcount,
20302030
co_code, co_filename, co_name, co_argcount,
20312031
co_posonlyargcount, co_kwonlyargcount, co_nlocals,
20322032
co_stacksize, co_flags) < 0) {
2033+
Py_XDECREF(code);
20332034
return NULL;
20342035
}
20352036

0 commit comments

Comments
 (0)