summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
Diffstat (limited to 'Objects')
-rw-r--r--Objects/obmalloc.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/Objects/obmalloc.c b/Objects/obmalloc.c
index f284d9f..32e7ecb 100644
--- a/Objects/obmalloc.c
+++ b/Objects/obmalloc.c
@@ -1227,10 +1227,7 @@ _PyObject_Alloc(int use_calloc, void *ctx, size_t nelem, size_t elsize)
_Py_AllocatedBlocks++;
- if (nelem == 0 || elsize == 0)
- goto redirect;
-
- assert(nelem <= PY_SSIZE_T_MAX / elsize);
+ assert(elsize == 0 || nelem <= PY_SSIZE_T_MAX / elsize);
nbytes = nelem * elsize;
#ifdef WITH_VALGRIND
@@ -1240,6 +1237,9 @@ _PyObject_Alloc(int use_calloc, void *ctx, size_t nelem, size_t elsize)
goto redirect;
#endif
+ if (nelem == 0 || elsize == 0)
+ goto redirect;
+
if ((nbytes - 1) < SMALL_REQUEST_THRESHOLD) {
LOCK();
/*