changeset 39423:ca77788c81bc stable

manifest: incref/decref copy->pydata to clarify 'copy' holds a reference
author Yuya Nishihara <yuya@tcha.org>
date Wed, 05 Sep 2018 21:46:53 +0900
parents adacefb0b7ea
children 094d1f42c484
files mercurial/cext/manifest.c
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cext/manifest.c	Wed Sep 05 20:52:22 2018 +0900
+++ b/mercurial/cext/manifest.c	Wed Sep 05 21:46:53 2018 +0900
@@ -725,7 +725,7 @@
 	copy->maxlines = self->maxlines;
 	copy->numlines = 0;
 	copy->pydata = self->pydata;
-	Py_INCREF(self->pydata);
+	Py_INCREF(copy->pydata);
 	for (i = 0; i < self->numlines; i++) {
 		PyObject *arglist = NULL, *result = NULL;
 		arglist = Py_BuildValue(PY23("(s)", "(y)"),
@@ -739,7 +739,7 @@
 		 * through and give up */
 		if (!result) {
 			free(copy->lines);
-			Py_DECREF(self->pydata);
+			Py_DECREF(copy->pydata);
 			return NULL;
 		}
 		if (PyObject_IsTrue(result)) {