[Python-Dev] [Python-checkins] cpython (3.4): Issue #23446: Use PyMem_New instead of PyMem_Malloc to avoid possible integer (original) (raw)

Stefan Krah stefan at bytereef.org
Mon Feb 16 17:34:24 CET 2015


On Mon, Feb 16, 2015 at 11:35:52AM +0000, serhiy.storchaka wrote:

diff --git a/Modules/testbuffer.c b/Modules/testbuffer.c --- a/Modules/testbuffer.c +++ b/Modules/testbuffer.c @@ -850,7 +850,7 @@ Pyssizet *dest; Pyssizet x, i;

- dest = PyMemMalloc(len * (sizeof *dest)); + dest = PyMemNew(Pyssizet, len); if (dest == NULL) { PyErrNoMemory(); return NULL;

This, too, was already protected by len == ndim <= 64.

Stefan Krah



More information about the Python-Dev mailing list