https://github.com/python/cpython/commit/4810beddbfc71fd8743bc89c5d07edef8877d754
commit: 4810beddbfc71fd8743bc89c5d07edef8877d754
branch: main
author: Yongtao Huang <[email protected]>
committer: vstinner <[email protected]>
date: 2026-04-01T18:34:55+02:00
summary:

gh-147960: Fix memory leak in crossinterp _tuple_shared() on alloc failure 
(#147961)

files:
M Python/crossinterp_data_lookup.h

diff --git a/Python/crossinterp_data_lookup.h b/Python/crossinterp_data_lookup.h
index cf84633e10e356..54422ad2335cb6 100644
--- a/Python/crossinterp_data_lookup.h
+++ b/Python/crossinterp_data_lookup.h
@@ -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;
     }
 

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to