chiark
/
gitweb
/
~mdw
/
catacomb-python
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
684cd53
)
mp.c: Arrange to free `xx' on exit.
author
Mark Wooding
<mdw@distorted.org.uk>
Sun, 10 Nov 2019 22:41:19 +0000
(22:41 +0000)
committer
Mark Wooding
<mdw@distorted.org.uk>
Fri, 22 Nov 2019 22:18:10 +0000
(22:18 +0000)
mp.c
patch
|
blob
|
blame
|
history
diff --git
a/mp.c
b/mp.c
index 77f7c3cc7c8c9b50882b4886478a1730299a0365..fff4aecda4fb7b792b56f955fcd6bf6d831bfcba 100644
(file)
--- a/
mp.c
+++ b/
mp.c
@@
-1721,7
+1721,7
@@
static PyObject *mpcrt_pynew(PyTypeObject *ty, PyObject *arg, PyObject *kw)
int n, i = 0;
char *kwlist[] = { "mv", 0 };
PyObject *q = 0, *x;
int n, i = 0;
char *kwlist[] = { "mv", 0 };
PyObject *q = 0, *x;
- mp *xx;
+ mp *xx
= MP_NEW
;
mpcrt_pyobj *c = 0;
if (PyTuple_Size(arg) > 1)
mpcrt_pyobj *c = 0;
if (PyTuple_Size(arg) > 1)
@@
-1738,11
+1738,12
@@
static PyObject *mpcrt_pynew(PyTypeObject *ty, PyObject *arg, PyObject *kw)
if ((x = PySequence_GetItem(q, i)) == 0) goto end;
xx = getmp(x); Py_DECREF(x); if (!xx) goto end;
if (MP_CMP(xx, <=, MP_ZERO)) VALERR("moduli must be positive");
if ((x = PySequence_GetItem(q, i)) == 0) goto end;
xx = getmp(x); Py_DECREF(x); if (!xx) goto end;
if (MP_CMP(xx, <=, MP_ZERO)) VALERR("moduli must be positive");
- v[i].m = xx; v[i].n = 0; v[i].ni = 0; v[i].nni = 0;
+ v[i].m = xx; v[i].n = 0; v[i].ni = 0; v[i].nni = 0;
xx = MP_NEW;
}
c = (mpcrt_pyobj *)ty->tp_alloc(ty, 0);
mpcrt_create(&c->c, v, n, 0);
Py_DECREF(q);
}
c = (mpcrt_pyobj *)ty->tp_alloc(ty, 0);
mpcrt_create(&c->c, v, n, 0);
Py_DECREF(q);
+ mp_drop(xx);
return ((PyObject *)c);
end:
return ((PyObject *)c);
end:
@@
-1753,6
+1754,7
@@
end:
xfree(v);
}
Py_XDECREF(q);
xfree(v);
}
Py_XDECREF(q);
+ mp_drop(xx);
return (0);
}
return (0);
}