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.
--- 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)