diff mercurial/parsers.c @ 23944:ec28f8b66e62 stable

parsers: avoid leaking obj in index_ancestors PySequence_GetItem returns a new reference. Found with cpychecker.
author Augie Fackler <augie@google.com>
date Fri, 23 Jan 2015 15:33:27 -0500
parents 5fb44983a696
children 33d6aaf84c9e
line wrap: on
line diff
--- a/mercurial/parsers.c	Fri Jan 23 15:30:21 2015 -0500
+++ b/mercurial/parsers.c	Fri Jan 23 15:33:27 2015 -0500
@@ -1691,9 +1691,11 @@
 		if (!PyInt_Check(obj)) {
 			PyErr_SetString(PyExc_TypeError,
 					"arguments must all be ints");
+			Py_DECREF(obj);
 			goto bail;
 		}
 		val = PyInt_AsLong(obj);
+		Py_DECREF(obj);
 		if (val == -1) {
 			ret = PyList_New(0);
 			goto done;