Patchwork [4,of,5,STABLE] manifest: incref/decref copy->pydata to clarify 'copy' holds a reference

login
register
mail settings
Submitter Yuya Nishihara
Date Sept. 5, 2018, 1:58 p.m.
Message ID <819cf6343fb821f3ef53.1536155906@mimosa>
Download mbox | patch
Permalink /patch/34339/
State Accepted
Headers show

Comments

Yuya Nishihara - Sept. 5, 2018, 1:58 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1536151613 -32400
#      Wed Sep 05 21:46:53 2018 +0900
# Branch stable
# Node ID 819cf6343fb821f3ef53768d722ab7990540f31f
# Parent  a55517cd5da69e41a7fafa0b46379920a5bda07f
manifest: incref/decref copy->pydata to clarify 'copy' holds a reference

Patch

diff --git a/mercurial/cext/manifest.c b/mercurial/cext/manifest.c
--- a/mercurial/cext/manifest.c
+++ b/mercurial/cext/manifest.c
@@ -725,7 +725,7 @@  static lazymanifest *lazymanifest_filter
 	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 @@  static lazymanifest *lazymanifest_filter
 		 * through and give up */
 		if (!result) {
 			free(copy->lines);
-			Py_DECREF(self->pydata);
+			Py_DECREF(copy->pydata);
 			return NULL;
 		}
 		if (PyObject_IsTrue(result)) {