[PATCH 06 of 11] parsers: use Python memory allocator for indexObject->offsets

Gregory Szorc gregory.szorc at gmail.com
Thu Mar 9 16:59:14 EST 2017


# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1489090171 28800
#      Thu Mar 09 12:09:31 2017 -0800
# Node ID b42943c2df62d6549bfd4ceb8f6dc16349e33528
# Parent  4a97eb780de33a2ddce8e25ce8d91353a7630b7b
parsers: use Python memory allocator for indexObject->offsets

diff --git a/mercurial/parsers.c b/mercurial/parsers.c
--- a/mercurial/parsers.c
+++ b/mercurial/parsers.c
@@ -800,8 +800,8 @@ static const char *index_deref(indexObje
 {
 	if (self->inlined && pos > 0) {
 		if (self->offsets == NULL) {
-			self->offsets = malloc(self->raw_length *
-					       sizeof(*self->offsets));
+			self->offsets = PyMem_Malloc(self->raw_length *
+					             sizeof(*self->offsets));
 			if (self->offsets == NULL)
 				return (const char *)PyErr_NoMemory();
 			inline_scan(self, self->offsets);
@@ -1016,7 +1016,7 @@ static void _index_clearcaches(indexObje
 		self->cache = NULL;
 	}
 	if (self->offsets) {
-		free(self->offsets);
+		PyMem_Free(self->offsets);
 		self->offsets = NULL;
 	}
 	if (self->nt) {


More information about the Mercurial-devel mailing list