]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
#15676: mmap: add empty file check prior to offset check <- Previous patch was incomp...
authorJesus Cea <jcea@jcea.es>
Mon, 10 Sep 2012 20:58:07 +0000 (22:58 +0200)
committerJesus Cea <jcea@jcea.es>
Mon, 10 Sep 2012 20:58:07 +0000 (22:58 +0200)
Modules/mmapmodule.c

index b993fdf92de408f0c11c3c76d93b1b660024d751..33c143eba8c7601c155eeed8452c313a5500fd6a 100644 (file)
@@ -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) {