summaryrefslogtreecommitdiff
path: root/Modules/mmapmodule.c
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2016-10-05 23:29:16 -0700
committerBenjamin Peterson <benjamin@python.org>2016-10-05 23:29:16 -0700
commit43441c77b5fd9617d7baff1cf3bbc072fef6035b (patch)
treed65afd042aa3f46961cf1590a2d06fbcfaec4996 /Modules/mmapmodule.c
parent267941c6758649e63d600faaedafcc0ef1c3fb2e (diff)
parent3776836f675f3d52b21713a45460f09a03af15df (diff)
downloadcpython-git-43441c77b5fd9617d7baff1cf3bbc072fef6035b.tar.gz
merge 3.5
Diffstat (limited to 'Modules/mmapmodule.c')
-rw-r--r--Modules/mmapmodule.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c
index 30084447c8..da68447f3e 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);