mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 15:27:13 +03:00
parsers: use Python memory allocator for indexObject->offsets
This commit is contained in:
parent
becdf838b6
commit
da814fb671
@ -817,8 +817,8 @@ static const char *index_deref(indexObject *self, Py_ssize_t pos)
|
|||||||
{
|
{
|
||||||
if (self->inlined && pos > 0) {
|
if (self->inlined && pos > 0) {
|
||||||
if (self->offsets == NULL) {
|
if (self->offsets == NULL) {
|
||||||
self->offsets = malloc(self->raw_length *
|
self->offsets = PyMem_Malloc(self->raw_length *
|
||||||
sizeof(*self->offsets));
|
sizeof(*self->offsets));
|
||||||
if (self->offsets == NULL)
|
if (self->offsets == NULL)
|
||||||
return (const char *)PyErr_NoMemory();
|
return (const char *)PyErr_NoMemory();
|
||||||
inline_scan(self, self->offsets);
|
inline_scan(self, self->offsets);
|
||||||
@ -1031,7 +1031,7 @@ static void _index_clearcaches(indexObject *self)
|
|||||||
self->cache = NULL;
|
self->cache = NULL;
|
||||||
}
|
}
|
||||||
if (self->offsets) {
|
if (self->offsets) {
|
||||||
free(self->offsets);
|
PyMem_Free(self->offsets);
|
||||||
self->offsets = NULL;
|
self->offsets = NULL;
|
||||||
}
|
}
|
||||||
if (self->nt) {
|
if (self->nt) {
|
||||||
|
Loading…
Reference in New Issue
Block a user