Mercurial > cpython-lru_cache-weakref
diff Python/pyarena.c @ 39135:12e973bdfeee legacy-trunk
Fix more memory allocation issues found with failmalloc.
| author | Neal Norwitz <nnorwitz@gmail.com> |
|---|---|
| date | Sat, 22 Jul 2006 16:20:49 +0000 |
| parents | 636ca80a8cbe |
| children | fd25030223b0 |
line wrap: on
line diff
--- a/Python/pyarena.c Fri Jul 21 22:44:07 2006 +0000 +++ b/Python/pyarena.c Sat Jul 22 16:20:49 2006 +0000 @@ -132,19 +132,19 @@ { 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 @@ { 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;
