diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2013-07-11 22:42:14 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2013-07-11 22:42:14 (GMT) |
commit | a41f08514463ffe1f985e1ef5b3e9123e7222dc5 (patch) | |
tree | 6677cbae4fe397a672a7d58f58778c37a4352619 /Objects | |
parent | fb3a630001ee40baa6f13743d32fd3a2756fcc3d (diff) | |
download | cpython-a41f08514463ffe1f985e1ef5b3e9123e7222dc5.zip cpython-a41f08514463ffe1f985e1ef5b3e9123e7222dc5.tar.gz cpython-a41f08514463ffe1f985e1ef5b3e9123e7222dc5.tar.bz2 |
Issue #18408: pmerge() help of mro_implementation() now raises MemoryError on
memory allocation failure
Replace also PyMem_Free() with PyMem_FREE() to be consistent with the rest of
the function.
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/typeobject.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 6eb2cf1..560c929 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -1456,8 +1456,10 @@ pmerge(PyObject *acc, PyObject* to_merge) { that is not included in acc. */ remain = (int *)PyMem_MALLOC(SIZEOF_INT*to_merge_size); - if (remain == NULL) + if (remain == NULL) { + PyErr_NoMemory(); return -1; + } for (i = 0; i < to_merge_size; i++) remain[i] = 0; @@ -1489,7 +1491,7 @@ pmerge(PyObject *acc, PyObject* to_merge) { } ok = PyList_Append(acc, candidate); if (ok < 0) { - PyMem_Free(remain); + PyMem_FREE(remain); return -1; } for (j = 0; j < to_merge_size; j++) { |