]> 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:57:34 +0000 (22:57 +0200)
committerJesus Cea <jcea@jcea.es>
Mon, 10 Sep 2012 20:57:34 +0000 (22:57 +0200)
Modules/mmapmodule.c

index 62d934c607fafb2d9aebd090a19b41e4a5220339..03685ce6c104d15b94fd64d1d126f27c0ff8efe5 100644 (file)
@@ -1391,6 +1391,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) {