From: Jesus Cea Date: Mon, 10 Sep 2012 20:58:07 +0000 (+0200) Subject: #15676: mmap: add empty file check prior to offset check <- Previous patch was incomp... X-Git-Tag: v3.2.4rc1~541 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e8db356cf1084105a97db9457a2374209868005b;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 b993fdf92de4..33c143eba8c7 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) {