# HG changeset patch # User Augie Fackler # Date 2015-12-31 18:31:42 # Node ID abc79f44f54812c7c6a434f32e4f076908ef2daa # Parent 512f883c234c24b13df33ceaf3fd66399c608d8a lazymanifest: check more return values in filtercopy Spotted by Bryan O'Sullivan (and vexingly not the static analyzer I've been using.) diff --git a/mercurial/manifest.c b/mercurial/manifest.c --- a/mercurial/manifest.c +++ b/mercurial/manifest.c @@ -707,11 +707,13 @@ static lazymanifest *lazymanifest_filter copy->pydata = self->pydata; Py_INCREF(self->pydata); for (i = 0; i < self->numlines; i++) { - PyObject *arg = PyString_FromString(self->lines[i].start); - PyObject *arglist = PyTuple_Pack(1, arg); - PyObject *result = PyObject_CallObject(matchfn, arglist); + PyObject *arglist = NULL, *result = NULL; + arglist = Py_BuildValue("(s)", self->lines[i].start); + if (!arglist) { + return NULL; + } + result = PyObject_CallObject(matchfn, arglist); Py_DECREF(arglist); - Py_DECREF(arg); /* if the callback raised an exception, just let it * through and give up */ if (!result) {