comparison 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
comparison
equal deleted inserted replaced
23943:5fb44983a696 23944:ec28f8b66e62
1689 long val; 1689 long val;
1690 1690
1691 if (!PyInt_Check(obj)) { 1691 if (!PyInt_Check(obj)) {
1692 PyErr_SetString(PyExc_TypeError, 1692 PyErr_SetString(PyExc_TypeError,
1693 "arguments must all be ints"); 1693 "arguments must all be ints");
1694 Py_DECREF(obj);
1694 goto bail; 1695 goto bail;
1695 } 1696 }
1696 val = PyInt_AsLong(obj); 1697 val = PyInt_AsLong(obj);
1698 Py_DECREF(obj);
1697 if (val == -1) { 1699 if (val == -1) {
1698 ret = PyList_New(0); 1700 ret = PyList_New(0);
1699 goto done; 1701 goto done;
1700 } 1702 }
1701 if (val < 0 || val >= len) { 1703 if (val < 0 || val >= len) {