mercurial/parsers.c
branchstable
changeset 25911 f4386cb3252e
parent 25860 895f04955a49
child 26004 ff89383a97db
--- a/mercurial/parsers.c	Mon Aug 03 20:34:36 2015 +0100
+++ b/mercurial/parsers.c	Thu Aug 06 22:54:28 2015 -0700
@@ -1113,6 +1113,7 @@
 	PyObject *phaseroots = NULL;
 	PyObject *phaseset = NULL;
 	PyObject *phasessetlist = NULL;
+	PyObject *rev = NULL;
 	Py_ssize_t len = index_length(self) - 1;
 	Py_ssize_t numphase = 0;
 	Py_ssize_t minrevallphases = 0;
@@ -1172,7 +1173,9 @@
 		 * is computed as a difference */
 		if (phase != 0) {
 			phaseset = PyList_GET_ITEM(phasessetlist, phase);
-			PySet_Add(phaseset, PyInt_FromLong(i));
+			rev = PyInt_FromLong(i);
+			PySet_Add(phaseset, rev);
+			Py_XDECREF(rev);
 		}
 		PyList_SET_ITEM(phaseslist, i, PyInt_FromLong(phase));
 	}