diff options
Diffstat (limited to 'Modules/_struct.c')
-rw-r--r-- | Modules/_struct.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Modules/_struct.c b/Modules/_struct.c index e21487d..d000df2 100644 --- a/Modules/_struct.c +++ b/Modules/_struct.c @@ -158,6 +158,7 @@ get_ulong(PyObject *v, unsigned long *p) return -1; assert(PyLong_Check(v)); x = PyLong_AsUnsignedLong(v); + Py_DECREF(v); if (x == (unsigned long)-1 && PyErr_Occurred()) { if (PyErr_ExceptionMatches(PyExc_OverflowError)) PyErr_SetString(StructError, @@ -182,6 +183,7 @@ get_longlong(PyObject *v, PY_LONG_LONG *p) return -1; assert(PyLong_Check(v)); x = PyLong_AsLongLong(v); + Py_DECREF(v); if (x == (PY_LONG_LONG)-1 && PyErr_Occurred()) { if (PyErr_ExceptionMatches(PyExc_OverflowError)) PyErr_SetString(StructError, @@ -204,6 +206,7 @@ get_ulonglong(PyObject *v, unsigned PY_LONG_LONG *p) return -1; assert(PyLong_Check(v)); x = PyLong_AsUnsignedLongLong(v); + Py_DECREF(v); if (x == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred()) { if (PyErr_ExceptionMatches(PyExc_OverflowError)) PyErr_SetString(StructError, |