[PATCH 09 of 11] parsers: use Python memory allocator in index_headrevs()
Gregory Szorc
gregory.szorc at gmail.com
Thu Mar 9 16:59:17 EST 2017
# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1489090417 28800
# Thu Mar 09 12:13:37 2017 -0800
# Node ID ed3df3cb9be2aaa06fdb5998508ef1e838778017
# Parent 66d9008cce9f3b543edf564956d804143747d3c6
parsers: use Python memory allocator in index_headrevs()
diff --git a/mercurial/parsers.c b/mercurial/parsers.c
--- a/mercurial/parsers.c
+++ b/mercurial/parsers.c
@@ -1463,11 +1463,12 @@ static PyObject *index_headrevs(indexObj
goto done;
}
- nothead = calloc(len, 1);
+ nothead = PyMem_Malloc(len);
if (nothead == NULL) {
PyErr_NoMemory();
goto bail;
}
+ memset(nothead, 0, len);
for (i = len - 1; i >= 0; i--) {
int isfiltered;
@@ -1514,12 +1515,12 @@ static PyObject *index_headrevs(indexObj
done:
self->headrevs = heads;
Py_XDECREF(filter);
- free(nothead);
+ PyMem_Free(nothead);
return list_copy(self->headrevs);
bail:
Py_XDECREF(filter);
Py_XDECREF(heads);
- free(nothead);
+ PyMem_Free(nothead);
return NULL;
}
More information about the Mercurial-devel
mailing list