# HG changeset patch # User Yuya Nishihara # Date 2015-08-15 10:38:03 # Node ID e7fe0a12376c6fe072c258c310f2044a4b3abe66 # Parent 10917b062adf262734bece9ab2454eae9494f57b reachableroots: handle error of PyList_Append() diff --git a/mercurial/parsers.c b/mercurial/parsers.c --- a/mercurial/parsers.c +++ b/mercurial/parsers.c @@ -1203,8 +1203,10 @@ static PyObject *reachableroots2(indexOb val = PyInt_FromLong(revnum); if (val == NULL) goto bail; - PyList_Append(reachable, val); + r = PyList_Append(reachable, val); Py_DECREF(val); + if (r < 0) + goto bail; if (includepath == 0) continue; } @@ -1245,8 +1247,10 @@ static PyObject *reachableroots2(indexOb val = PyInt_FromLong(i); if (val == NULL) goto bail; - PyList_Append(reachable, val); + r = PyList_Append(reachable, val); Py_DECREF(val); + if (r < 0) + goto bail; } } }