[Python-checkins] cpython (3.5): do not leak buffer if mmap is not writable
benjamin.peterson
python-checkins at python.org
Thu Oct 6 02:29:29 EDT 2016
https://hg.python.org/cpython/rev/dfb9088f7308
changeset: 104330:dfb9088f7308
branch: 3.5
parent: 104324:c39ab06feacc
user: Benjamin Peterson <benjamin at python.org>
date: Wed Oct 05 23:29:07 2016 -0700
summary:
do not leak buffer if mmap is not writable
files:
Modules/mmapmodule.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c
--- a/Modules/mmapmodule.c
+++ b/Modules/mmapmodule.c
@@ -383,8 +383,10 @@
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);
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list