Fix possible refleak in CodeType.replace() (GH-106243)

A reference to c_code was leaked if PySys_Audit() failed.
This commit is contained in:
Serhiy Storchaka 2023-06-29 17:22:15 +03:00 committed by GitHub
parent fb0d9b9ac1
commit 3c70d467c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;
}