changeset 39421:ad76032d27da stable

xdiff: fix leak in hunk_consumer() Spotted by ASAN. Since PyList_Append() does not "steal" a reference, Py_DECREF() is always required. Perhaps, this is the largest leak in this series.
author Yuya Nishihara <yuya@tcha.org>
date Wed, 05 Sep 2018 22:10:41 +0900
parents 91477b123700
children adacefb0b7ea
files mercurial/cext/bdiff.c
diffstat 1 files changed, 4 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cext/bdiff.c	Wed Sep 05 20:57:38 2018 +0900
+++ b/mercurial/cext/bdiff.c	Wed Sep 05 22:10:41 2018 +0900
@@ -256,13 +256,12 @@
 {
 	PyObject *rl = (PyObject *)priv;
 	PyObject *m = Py_BuildValue("LLLL", a1, a2, b1, b2);
+	int r;
 	if (!m)
 		return -1;
-	if (PyList_Append(rl, m) != 0) {
-		Py_DECREF(m);
-		return -1;
-	}
-	return 0;
+	r = PyList_Append(rl, m);
+	Py_DECREF(m);
+	return r;
 }
 
 static PyObject *xdiffblocks(PyObject *self, PyObject *args)