changeset 27661:abc79f44f548

lazymanifest: check more return values in filtercopy Spotted by Bryan O'Sullivan (and vexingly not the static analyzer I've been using.)
author Augie Fackler <raf@durin42.com>
date Thu, 31 Dec 2015 13:31:42 -0500
parents 512f883c234c
children f7ab50c721ac
files mercurial/manifest.c
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/manifest.c	Thu Dec 17 10:30:17 2015 +0000
+++ b/mercurial/manifest.c	Thu Dec 31 13:31:42 2015 -0500
@@ -707,11 +707,13 @@
 	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) {