From: Mark Wooding Date: Sun, 24 Nov 2019 22:16:53 +0000 (+0000) Subject: ec.c: Free partially constructed points coordinatewise. X-Git-Url: https://git.distorted.org.uk/~mdw/catacomb-python/commitdiff_plain/08720fe03bb49ed4df3b0fbd99c2c8eec145fdcc ec.c: Free partially constructed points coordinatewise. The `EC_DESTROY' macro assumes that the other coordinates are null if and only if `p->x' is. This works badly with the current code structure, which fills in coordinates as it goes along, and I think this is a better fix than trying to maintain the coordinates in temporaries until we're done. --- diff --git a/ec.c b/ec.c index 6280010..f0747a8 100644 --- a/ec.c +++ b/ec.c @@ -508,7 +508,7 @@ static PyObject *ecptnc_pynew(PyTypeObject *ty, PyObject *arg, PyObject *kw) goto end; return (ecpt_pywrapout(ty, &p)); end: - EC_DESTROY(&p); + mp_drop(p.x); mp_drop(p.y); mp_drop(p.z); return (0); } @@ -550,7 +550,7 @@ static PyObject *ecpt_pynew(PyTypeObject *ty, PyObject *arg, PyObject *kw) goto end; return (ecpt_pywrap((PyObject *)ty, &p)); end: - EC_DESTROY(&p); + mp_drop(p.x); mp_drop(p.y); mp_drop(p.z); return (0); }