Issue #18408: _PyMemoTable_ResizeTable() now restores the old table if

allocating a bigger table failed

PyMemoTable destructor does crash if mt_table is NULL.
This commit is contained in:
Victor Stinner 2013-07-12 00:53:26 +02:00
parent a41f085144
commit 8ca72e2e3d
1 changed files with 1 additions and 1 deletions

View File

@ -529,7 +529,7 @@ _PyMemoTable_ResizeTable(PyMemoTable *self, Py_ssize_t min_size)
oldtable = self->mt_table;
self->mt_table = PyMem_MALLOC(new_size * sizeof(PyMemoEntry));
if (self->mt_table == NULL) {
PyMem_FREE(oldtable);
self->mt_table = oldtable;
PyErr_NoMemory();
return -1;
}