# HG changeset patch # User Augie Fackler # Date 2015-08-18 20:43:26 # Node ID b1634b7804c73f50b4858e8c8cc7b241767d57d2 # Parent 0be2f81aadc3d457643e2e636f9e465a0cbb00e5 parsers: correctly decref normed value after PyDict_SetItem Previously we were leaving this PyObject* with a refcount that was one too high. Detected with cpychecker. diff --git a/mercurial/parsers.c b/mercurial/parsers.c --- a/mercurial/parsers.c +++ b/mercurial/parsers.c @@ -253,8 +253,11 @@ static PyObject *make_file_foldmap(PyObj if (normed == NULL) goto quit; - if (PyDict_SetItem(file_foldmap, normed, k) == -1) + if (PyDict_SetItem(file_foldmap, normed, k) == -1) { + Py_DECREF(normed); goto quit; + } + Py_DECREF(normed); } } return file_foldmap;