PyLong_FromString(): Nailed a small memory leak. In the str==start

test, we forgot that z is still pointing to a real live object.
DECREF() it before returning.
This commit is contained in:
Barry Warsaw 1999-01-27 17:48:27 +00:00
parent aa2aea0e79
commit b5cebfe164
1 changed files with 1 additions and 0 deletions

View File

@ -769,6 +769,7 @@ PyLong_FromString(str, pend, base)
if (str == start) { if (str == start) {
PyErr_SetString(PyExc_ValueError, PyErr_SetString(PyExc_ValueError,
"no digits in long int constant"); "no digits in long int constant");
Py_DECREF(z);
return NULL; return NULL;
} }
if (sign < 0 && z != NULL && z->ob_size != 0) if (sign < 0 && z != NULL && z->ob_size != 0)