]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-147960: Fix memory leak in crossinterp _tuple_shared() on alloc failure (#147961)
authorYongtao Huang <yongtaoh2022@gmail.com>
Wed, 1 Apr 2026 16:34:55 +0000 (00:34 +0800)
committerGitHub <noreply@github.com>
Wed, 1 Apr 2026 16:34:55 +0000 (18:34 +0200)
Python/crossinterp_data_lookup.h

index cf84633e10e356ca50db3c44bc3ee51dc455ac25..54422ad2335cb6247e28dee3bd43bc9221cd3558 100644 (file)
@@ -657,6 +657,7 @@ _tuple_shared(PyThreadState *tstate, PyObject *obj, xidata_fallback_t fallback,
     shared->items = (_PyXIData_t **) PyMem_Calloc(shared->len, sizeof(_PyXIData_t *));
     if (shared->items == NULL) {
         PyErr_NoMemory();
+        PyMem_RawFree(shared);
         return -1;
     }