[PATCH 2 of 2] parsers: check results of PyInt_FromLong (issue4771)
Bryan O'Sullivan
bos at serpentine.com
Sat Dec 12 22:11:51 CST 2015
# HG changeset patch
# User Bryan O'Sullivan <bos at serpentine.com>
# Date 1449979904 28800
# Sat Dec 12 20:11:44 2015 -0800
# Node ID 7d1b0fa50a8f1f856104aa7afd60f54b736ae170
# Parent 6c0dd7cd82797705c5be51be892afd94a4909a65
parsers: check results of PyInt_FromLong (issue4771)
diff --git a/mercurial/parsers.c b/mercurial/parsers.c
--- a/mercurial/parsers.c
+++ b/mercurial/parsers.c
@@ -1272,6 +1272,7 @@ static PyObject *compute_phases_map_sets
PyObject *phaseset = NULL;
PyObject *phasessetlist = NULL;
PyObject *rev = NULL;
+ PyObject *phaseval;
Py_ssize_t len = index_length(self) - 1;
Py_ssize_t numphase = 0;
Py_ssize_t minrevallphases = 0;
@@ -1332,10 +1333,15 @@ static PyObject *compute_phases_map_sets
if (phase != 0) {
phaseset = PyList_GET_ITEM(phasessetlist, phase);
rev = PyInt_FromLong(i);
+ if (rev == NULL)
+ goto release;
PySet_Add(phaseset, rev);
Py_XDECREF(rev);
}
- PyList_SET_ITEM(phaseslist, i, PyInt_FromLong(phase));
+ phaseval = PyInt_FromLong(phase);
+ if (phaseval == NULL)
+ goto release;
+ PyList_SET_ITEM(phaseslist, i, phaseval);
}
ret = PyList_New(2);
if (ret == NULL)
More information about the Mercurial-devel
mailing list