diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c index 3e209341298..d650eaec955 100644 --- a/Modules/mmapmodule.c +++ b/Modules/mmapmodule.c @@ -1367,6 +1367,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) {