summaryrefslogtreecommitdiffstats
path: root/Objects/longobject.c
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>1999-01-27 17:48:27 (GMT)
committerBarry Warsaw <barry@python.org>1999-01-27 17:48:27 (GMT)
commitb5cebfe164fbf6c862e8aa9fb91628d1b8cf76be (patch)
treea1e8031931181d6edb09750525edaa4d511d2c0a /Objects/longobject.c
parentaa2aea0e796d6f6b495a23c0fc4d5c66967948ba (diff)
downloadcpython-b5cebfe164fbf6c862e8aa9fb91628d1b8cf76be.zip
cpython-b5cebfe164fbf6c862e8aa9fb91628d1b8cf76be.tar.gz
cpython-b5cebfe164fbf6c862e8aa9fb91628d1b8cf76be.tar.bz2
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.
Diffstat (limited to 'Objects/longobject.c')
-rw-r--r--Objects/longobject.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/Objects/longobject.c b/Objects/longobject.c
index 834b8a8..7c805a5 100644
--- a/Objects/longobject.c
+++ b/Objects/longobject.c
@@ -769,6 +769,7 @@ PyLong_FromString(str, pend, base)
if (str == start) {
PyErr_SetString(PyExc_ValueError,
"no digits in long int constant");
+ Py_DECREF(z);
return NULL;
}
if (sign < 0 && z != NULL && z->ob_size != 0)