parsers: use Python memory allocator in commonancestorsheads()
authorGregory Szorc <gregory.szorc@gmail.com>
Thu, 09 Mar 2017 12:02:59 -0800
changeset 31469 a43fd9ec2a39
parent 31468 b9dd03ed564f
child 31470 bc445c556d3c
parsers: use Python memory allocator in commonancestorsheads()
mercurial/parsers.c
--- a/mercurial/parsers.c	Thu Mar 09 11:56:47 2017 -0800
+++ b/mercurial/parsers.c	Thu Mar 09 12:02:59 2017 -0800
@@ -2166,7 +2166,7 @@
 	int *revs;
 
 	argcount = PySequence_Length(args);
-	revs = malloc(argcount * sizeof(*revs));
+	revs = PyMem_Malloc(argcount * sizeof(*revs));
 	if (argcount > 0 && revs == NULL)
 		return PyErr_NoMemory();
 	len = index_length(self) - 1;
@@ -2237,11 +2237,11 @@
 		goto bail;
 
 done:
-	free(revs);
+	PyMem_Free(revs);
 	return ret;
 
 bail:
-	free(revs);
+	PyMem_Free(revs);
 	Py_XDECREF(ret);
 	return NULL;
 }