From: Mark Shannon Date: Thu, 4 Dec 2025 12:27:15 +0000 (+0000) Subject: GH-139757: Fix reference leaks introduced in GH-140800 (GH-142257) X-Git-Tag: v3.15.0a3~207 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6825d5c11ddb1dac7602fde55f0ed64e1aab50e7;p=thirdparty%2FPython%2Fcpython.git GH-139757: Fix reference leaks introduced in GH-140800 (GH-142257) --- diff --git a/Python/ceval.c b/Python/ceval.c index 1709dda0cbe1..46bf644106ac 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -1228,6 +1228,8 @@ _Py_BuildString_StackRefSteal( goto cleanup; } res = _PyUnicode_JoinArray(&_Py_STR(empty), args_o, total_args); + STACKREFS_TO_PYOBJECTS_CLEANUP(args_o); + assert((res != NULL) ^ (PyErr_Occurred() != NULL)); cleanup: // arguments is a pointer into the GC visible stack, // so we must NULL out values as we clear them. @@ -1239,8 +1241,6 @@ cleanup: return res; } - - PyObject * _Py_BuildMap_StackRefSteal( _PyStackRef *arguments, @@ -1257,6 +1257,8 @@ _Py_BuildMap_StackRefSteal( args_o+1, 2, half_args ); + STACKREFS_TO_PYOBJECTS_CLEANUP(args_o); + assert((res != NULL) ^ (PyErr_Occurred() != NULL)); cleanup: // arguments is a pointer into the GC visible stack, // so we must NULL out values as we clear them.