[Python-checkins] cpython: Issue #18408: _PyMemoTable_ResizeTable() now restores the old table if

victor.stinner python-checkins at python.org
Fri Jul 12 00:59:11 CEST 2013


http://hg.python.org/cpython/rev/f85fcbbbe8de
changeset:   84576:f85fcbbbe8de
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Fri Jul 12 00:53:26 2013 +0200
summary:
  Issue #18408: _PyMemoTable_ResizeTable() now restores the old table if
allocating a bigger table failed

PyMemoTable destructor does crash if mt_table is NULL.

files:
  Modules/_pickle.c |  2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)


diff --git a/Modules/_pickle.c b/Modules/_pickle.c
--- a/Modules/_pickle.c
+++ b/Modules/_pickle.c
@@ -529,7 +529,7 @@
     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;
     }

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list