From: Mark Wooding Date: Mon, 25 Nov 2019 13:25:34 +0000 (+0000) Subject: mp.c: Simplify final cleanup in `MPCRT' operations. X-Git-Url: https://git.distorted.org.uk/~mdw/catacomb-python/commitdiff_plain/d2d1550411f009fc0d816c354290e2c041ec6d6b mp.c: Simplify final cleanup in `MPCRT' operations. --- diff --git a/mp.c b/mp.c index 6ce2792..456c905 100644 --- a/mp.c +++ b/mp.c @@ -1805,9 +1805,7 @@ static PyObject *mcmeth_solve(PyObject *me, PyObject *arg) z = mp_pywrap(mpcrt_solve(c, MP_NEW, v)); end: if (v) { - n = i; - for (i = 0; i < n; i++) - MP_DROP(v[i]); + while (i--) MP_DROP(v[i]); xfree(v); } return (z); @@ -1860,9 +1858,7 @@ static PyObject *mpcrt_pynew(PyTypeObject *ty, PyObject *arg, PyObject *kw) end: if (v) { - n = i; - for (i = 0; i < n; i++) - MP_DROP(v[i].m); + while (i--) MP_DROP(v[i].m); xfree(v); } mp_drop(xx); mp_drop(y); mp_drop(g);