summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2016-10-06 06:29:16 (GMT)
committerBenjamin Peterson <benjamin@python.org>2016-10-06 06:29:16 (GMT)
commit43441c77b5fd9617d7baff1cf3bbc072fef6035b (patch)
treed65afd042aa3f46961cf1590a2d06fbcfaec4996
parent267941c6758649e63d600faaedafcc0ef1c3fb2e (diff)
parent3776836f675f3d52b21713a45460f09a03af15df (diff)
downloadcpython-43441c77b5fd9617d7baff1cf3bbc072fef6035b.zip
cpython-43441c77b5fd9617d7baff1cf3bbc072fef6035b.tar.gz
cpython-43441c77b5fd9617d7baff1cf3bbc072fef6035b.tar.bz2
merge 3.5
-rw-r--r--Modules/mmapmodule.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c
index 3008444..da68447 100644
--- a/Modules/mmapmodule.c
+++ b/Modules/mmapmodule.c
@@ -383,8 +383,10 @@ mmap_write_method(mmap_object *self,
if (!PyArg_ParseTuple(args, "y*:write", &data))
return(NULL);
- if (!is_writable(self))
+ if (!is_writable(self)) {
+ PyBuffer_Release(&data);
return NULL;
+ }
if (self->pos > self->size || self->size - self->pos < data.len) {
PyBuffer_Release(&data);