Mercurial > hg-stable
changeset 27365:ec04370bdfaf
parsers: check results of PyInt_FromLong (issue4771)
author | Bryan O'Sullivan <bos@serpentine.com> |
---|---|
date | Mon, 14 Dec 2015 10:47:26 -0800 |
parents | ad1cc1435b13 |
children | 7e8a883da171 |
files | mercurial/parsers.c |
diffstat | 1 files changed, 8 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/parsers.c Mon Dec 14 10:47:24 2015 -0800 +++ b/mercurial/parsers.c Mon Dec 14 10:47:26 2015 -0800 @@ -1333,16 +1333,23 @@ if (phaseslist == NULL) goto release; for (i = 0; i < len; i++) { + PyObject *phaseval; + phase = phases[i]; /* We only store the sets of phase for non public phase, the public phase * is computed as a difference */ 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)