parsers: use Python memory allocator for indexObject->offsets

This commit is contained in:
Gregory Szorc 2017-03-09 12:09:31 -08:00
parent becdf838b6
commit da814fb671

View File

@ -817,7 +817,7 @@ static const char *index_deref(indexObject *self, Py_ssize_t pos)
{
if (self->inlined && pos > 0) {
if (self->offsets == NULL) {
self->offsets = malloc(self->raw_length *
self->offsets = PyMem_Malloc(self->raw_length *
sizeof(*self->offsets));
if (self->offsets == NULL)
return (const char *)PyErr_NoMemory();
@ -1031,7 +1031,7 @@ static void _index_clearcaches(indexObject *self)
self->cache = NULL;
}
if (self->offsets) {
free(self->offsets);
PyMem_Free(self->offsets);
self->offsets = NULL;
}
if (self->nt) {