summaryrefslogtreecommitdiffstats
path: root/Modules/mmapmodule.c
diff options
context:
space:
mode:
authorJesus Cea <jcea@jcea.es>2012-09-10 20:58:07 (GMT)
committerJesus Cea <jcea@jcea.es>2012-09-10 20:58:07 (GMT)
commite8db356cf1084105a97db9457a2374209868005b (patch)
tree92510438a6883be8022200d886880d3f44c1e77d /Modules/mmapmodule.c
parent1f2799bef45673419e96ad4ef6a923c59d1c6a85 (diff)
downloadcpython-e8db356cf1084105a97db9457a2374209868005b.zip
cpython-e8db356cf1084105a97db9457a2374209868005b.tar.gz
cpython-e8db356cf1084105a97db9457a2374209868005b.tar.bz2
#15676: mmap: add empty file check prior to offset check <- Previous patch was incomplete (fix 2)
Diffstat (limited to 'Modules/mmapmodule.c')
-rw-r--r--Modules/mmapmodule.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c
index b993fdf..33c143e 100644
--- a/Modules/mmapmodule.c
+++ b/Modules/mmapmodule.c
@@ -1345,6 +1345,7 @@ new_mmap_object(PyTypeObject *type, PyObject *args, PyObject *kwdict)
if (size == 0) {
PyErr_SetString(PyExc_ValueError,
"cannot mmap an empty file");
+ Py_DECREF(m_obj);
return NULL;
}
if (offset >= size) {