mercurial/parsers.c
changeset 26048 0be2f81aadc3
parent 26044 b3ad349d0e50
child 26049 b1634b7804c7
--- a/mercurial/parsers.c	Tue Aug 18 18:38:56 2015 -0500
+++ b/mercurial/parsers.c	Tue Aug 18 17:15:04 2015 -0400
@@ -2158,16 +2158,18 @@
  */
 static PyObject *index_ancestors(indexObject *self, PyObject *args)
 {
+	PyObject *ret;
 	PyObject *gca = index_commonancestorsheads(self, args);
 	if (gca == NULL)
 		return NULL;
 
 	if (PyList_GET_SIZE(gca) <= 1) {
-		Py_INCREF(gca);
 		return gca;
 	}
 
-	return find_deepest(self, gca);
+	ret = find_deepest(self, gca);
+	Py_DECREF(gca);
+	return ret;
 }
 
 /*