diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2014-05-06 09:32:29 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2014-05-06 09:32:29 (GMT) |
commit | 3080d926afca339eb392fffa46498b52eead3a16 (patch) | |
tree | 5950387211179910d6c50c78bf442b3829d21f4c | |
parent | 8c9f480e9ca033e2fd1632aa4c9e9ce5bb098304 (diff) | |
download | cpython-3080d926afca339eb392fffa46498b52eead3a16.zip cpython-3080d926afca339eb392fffa46498b52eead3a16.tar.gz cpython-3080d926afca339eb392fffa46498b52eead3a16.tar.bz2 |
Issue #21233: Fix _PyObject_Alloc() when compiled with WITH_VALGRIND defined
-rw-r--r-- | Objects/obmalloc.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Objects/obmalloc.c b/Objects/obmalloc.c index e16a1db..af2bab0 100644 --- a/Objects/obmalloc.c +++ b/Objects/obmalloc.c @@ -1176,6 +1176,9 @@ _PyObject_Alloc(int use_calloc, void *ctx, size_t nelem, size_t elsize) _Py_AllocatedBlocks++; + assert(nelem <= PY_SSIZE_T_MAX / elsize); + nbytes = nelem * elsize; + #ifdef WITH_VALGRIND if (UNLIKELY(running_on_valgrind == -1)) running_on_valgrind = RUNNING_ON_VALGRIND; @@ -1183,9 +1186,6 @@ _PyObject_Alloc(int use_calloc, void *ctx, size_t nelem, size_t elsize) goto redirect; #endif - assert(nelem <= PY_SSIZE_T_MAX / elsize); - nbytes = nelem * elsize; - if (nelem == 0 || elsize == 0) goto redirect; |