summaryrefslogtreecommitdiffstats
path: root/Python/pyarena.c
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2006-07-22 16:20:49 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2006-07-22 16:20:49 (GMT)
commitb59d08c2fb407bbb1527b72141e125760863c2ba (patch)
treeedb47a12535cd4e70352d3f396f68bbd6326299a /Python/pyarena.c
parent468e45edc1694606b6f2c4eb901eb9485bb493da (diff)
downloadcpython-b59d08c2fb407bbb1527b72141e125760863c2ba.zip
cpython-b59d08c2fb407bbb1527b72141e125760863c2ba.tar.gz
cpython-b59d08c2fb407bbb1527b72141e125760863c2ba.tar.bz2
Fix more memory allocation issues found with failmalloc.
Diffstat (limited to 'Python/pyarena.c')
-rw-r--r--Python/pyarena.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/Python/pyarena.c b/Python/pyarena.c
index f11a905..f4cc474 100644
--- a/Python/pyarena.c
+++ b/Python/pyarena.c
@@ -132,19 +132,19 @@ PyArena_New()
{
PyArena* arena = (PyArena *)malloc(sizeof(PyArena));
if (!arena)
- return NULL;
+ return (PyArena*)PyErr_NoMemory();
arena->a_head = block_new(DEFAULT_BLOCK_SIZE);
arena->a_cur = arena->a_head;
if (!arena->a_head) {
free((void *)arena);
- return NULL;
+ return (PyArena*)PyErr_NoMemory();
}
arena->a_objects = PyList_New(0);
if (!arena->a_objects) {
block_free(arena->a_head);
free((void *)arena);
- return NULL;
+ return (PyArena*)PyErr_NoMemory();
}
#if defined(Py_DEBUG)
arena->total_allocs = 0;
@@ -191,7 +191,7 @@ PyArena_Malloc(PyArena *arena, size_t size)
{
void *p = block_alloc(arena->a_cur, size);
if (!p)
- return NULL;
+ return PyErr_NoMemory();
#if defined(Py_DEBUG)
arena->total_allocs++;
arena->total_size += size;