# HG changeset patch # User Augie Fackler # Date 1539013326 14400 # Node ID 129bfc7ad2ccac6775041ec7751d67b01f57c8cd # Parent 1d09ba0d2ed3d19f1ca1b116591cc413eb87ac65 revlog: if the module is initialized more than once, don't leak nullentry Caught (annoyingly) by the manifest fuzzer. Differential Revision: https://phab.mercurial-scm.org/D4905 diff -r 1d09ba0d2ed3 -r 129bfc7ad2cc mercurial/cext/revlog.c --- a/mercurial/cext/revlog.c Mon Oct 01 14:31:15 2018 -0700 +++ b/mercurial/cext/revlog.c Mon Oct 08 11:42:06 2018 -0400 @@ -2304,8 +2304,10 @@ Py_INCREF(&nodetreeType); PyModule_AddObject(mod, "nodetree", (PyObject *)&nodetreeType); - nullentry = Py_BuildValue(PY23("iiiiiiis#", "iiiiiiiy#"), 0, 0, 0, - -1, -1, -1, -1, nullid, 20); + if (!nullentry) { + nullentry = Py_BuildValue(PY23("iiiiiiis#", "iiiiiiiy#"), 0, 0, 0, + -1, -1, -1, -1, nullid, 20); + } if (nullentry) PyObject_GC_UnTrack(nullentry); }