Skip to content

Commit 12f9ed3

Browse files
committed
Fix: avoid memory leak in _tuple_shared() on allocation failure
1 parent 4497cf3 commit 12f9ed3

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

Python/crossinterp_data_lookup.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -657,6 +657,7 @@ _tuple_shared(PyThreadState *tstate, PyObject *obj, xidata_fallback_t fallback,
657657
shared->items = (_PyXIData_t **) PyMem_Calloc(shared->len, sizeof(_PyXIData_t *));
658658
if (shared->items == NULL) {
659659
PyErr_NoMemory();
660+
PyMem_RawFree(shared);
660661
return -1;
661662
}
662663

0 commit comments

Comments
 (0)