mirror of https://github.com/python/cpython.git
Issue #21233: Oops, Fix _PyObject_Alloc(): initialize nbytes before going to
redirect.
This commit is contained in:
parent
db067af12a
commit
af8fc645af
|
@ -1183,12 +1183,12 @@ _PyObject_Alloc(int use_calloc, void *ctx, size_t nelem, size_t elsize)
|
||||||
goto redirect;
|
goto redirect;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (nelem == 0 || elsize == 0)
|
|
||||||
goto redirect;
|
|
||||||
|
|
||||||
assert(nelem <= PY_SSIZE_T_MAX / elsize);
|
assert(nelem <= PY_SSIZE_T_MAX / elsize);
|
||||||
nbytes = nelem * elsize;
|
nbytes = nelem * elsize;
|
||||||
|
|
||||||
|
if (nelem == 0 || elsize == 0)
|
||||||
|
goto redirect;
|
||||||
|
|
||||||
if ((nbytes - 1) < SMALL_REQUEST_THRESHOLD) {
|
if ((nbytes - 1) < SMALL_REQUEST_THRESHOLD) {
|
||||||
LOCK();
|
LOCK();
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue