From: Jesus Cea Date: Mon, 10 Sep 2012 20:57:34 +0000 (+0200) Subject: #15676: mmap: add empty file check prior to offset check <- Previous patch was incomp... X-Git-Tag: v2.7.4rc1~569 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8e03b4cae0cf37aac52827523fb3cf56894ffdf9;p=thirdparty%2FPython%2Fcpython.git #15676: mmap: add empty file check prior to offset check <- Previous patch was incomplete (fix 2) --- diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c index 62d934c607fa..03685ce6c104 100644 --- a/Modules/mmapmodule.c +++ b/Modules/mmapmodule.c @@ -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) {