[Python-checkins] r57189 - python/branches/alex-py3k/Modules/_bytesiomodule.c

alexandre.vassalotti python-checkins at python.org
Sun Aug 19 01:19:44 CEST 2007


Author: alexandre.vassalotti
Date: Sun Aug 19 01:18:45 2007
New Revision: 57189

Modified:
   python/branches/alex-py3k/Modules/_bytesiomodule.c
Log:
Fix a reference leak in read1() of BytesIO.


Modified: python/branches/alex-py3k/Modules/_bytesiomodule.c
==============================================================================
--- python/branches/alex-py3k/Modules/_bytesiomodule.c	(original)
+++ python/branches/alex-py3k/Modules/_bytesiomodule.c	Sun Aug 19 01:18:45 2007
@@ -183,7 +183,14 @@
 static PyObject *
 bytesio_read1(BytesIOObject *self, PyObject *n)
 {
-    return bytesio_read(self, Py_BuildValue("(O)", n));
+    PyObject *arg, *res;
+
+    arg = Py_BuildValue("(O)", n);
+    if (arg == NULL)
+        return NULL;
+    res  = bytesio_read(self, arg);
+    Py_DECREF(arg);
+    return res;
 }
 
 static PyObject *


More information about the Python-checkins mailing list