summaryrefslogtreecommitdiffstats
path: root/Objects/abstract.c
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2008-08-27 00:31:37 (GMT)
committerBenjamin Peterson <benjamin@python.org>2008-08-27 00:31:37 (GMT)
commit9edd2bd35cfc5f33b53c5def02cac23e7bb6e84b (patch)
tree4ccbdce39b24128ed28c1979cb07eaf361f0ae62 /Objects/abstract.c
parent4b24a42f3c72b4f88da8989a77a175e654dbdcbb (diff)
downloadcpython-9edd2bd35cfc5f33b53c5def02cac23e7bb6e84b.zip
cpython-9edd2bd35cfc5f33b53c5def02cac23e7bb6e84b.tar.gz
cpython-9edd2bd35cfc5f33b53c5def02cac23e7bb6e84b.tar.bz2
Fix #3651 various memory leaks when using the buffer interface
by Amaury Forgeot d'Arc Reviewer: Antoine Pitrou
Diffstat (limited to 'Objects/abstract.c')
-rw-r--r--Objects/abstract.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/Objects/abstract.c b/Objects/abstract.c
index ac61011..39cb803 100644
--- a/Objects/abstract.c
+++ b/Objects/abstract.c
@@ -260,6 +260,7 @@ PyObject_AsCharBuffer(PyObject *obj,
*buffer_len = view.len;
if (pb->bf_releasebuffer != NULL)
(*pb->bf_releasebuffer)(obj, &view);
+ Py_XDECREF(view.obj);
return 0;
}
@@ -305,6 +306,7 @@ int PyObject_AsReadBuffer(PyObject *obj,
*buffer_len = view.len;
if (pb->bf_releasebuffer != NULL)
(*pb->bf_releasebuffer)(obj, &view);
+ Py_XDECREF(view.obj);
return 0;
}
@@ -332,6 +334,7 @@ int PyObject_AsWriteBuffer(PyObject *obj,
*buffer_len = view.len;
if (pb->bf_releasebuffer != NULL)
(*pb->bf_releasebuffer)(obj, &view);
+ Py_XDECREF(view.obj);
return 0;
}