diff options
Diffstat (limited to 'Objects/obmalloc.c')
-rw-r--r-- | Objects/obmalloc.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Objects/obmalloc.c b/Objects/obmalloc.c index 5943f5a..3028f22 100644 --- a/Objects/obmalloc.c +++ b/Objects/obmalloc.c @@ -778,6 +778,8 @@ PyObject_Malloc(size_t nbytes) poolp next; uint size; + _Py_AllocatedBlocks++; + #ifdef WITH_VALGRIND if (UNLIKELY(running_on_valgrind == -1)) running_on_valgrind = RUNNING_ON_VALGRIND; @@ -791,10 +793,10 @@ PyObject_Malloc(size_t nbytes) * things without checking for overflows or negatives. * As size_t is unsigned, checking for nbytes < 0 is not required. */ - if (nbytes > PY_SSIZE_T_MAX) + if (nbytes > PY_SSIZE_T_MAX) { + _Py_AllocatedBlocks--; return NULL; - - _Py_AllocatedBlocks++; + } /* * This implicitly redirects malloc(0). |