From: stratakis Date: Thu, 14 Mar 2019 15:10:58 +0000 (+0100) Subject: [2.7] bpo-36212: Fix two possible reference leaks in the hotshot module (GH-12327) X-Git-Tag: v2.7.17rc1~121 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2832ad53358e3fbc4bdc601b9f3fa04dd0deae46;p=thirdparty%2FPython%2Fcpython.git [2.7] bpo-36212: Fix two possible reference leaks in the hotshot module (GH-12327) Fix reference leaks in _hotshot.LogReaderType on PyTuple_New() failure. --- diff --git a/Misc/NEWS.d/next/Library/2019-03-14-14-40-22.bpo-36212.IEgRI8.rst b/Misc/NEWS.d/next/Library/2019-03-14-14-40-22.bpo-36212.IEgRI8.rst new file mode 100644 index 000000000000..b2d264234e4d --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-03-14-14-40-22.bpo-36212.IEgRI8.rst @@ -0,0 +1 @@ +Fix two possible reference leaks in the hotshot module. diff --git a/Modules/_hotshot.c b/Modules/_hotshot.c index 33cd38da2ffe..4fc5cee479e5 100644 --- a/Modules/_hotshot.c +++ b/Modules/_hotshot.c @@ -482,8 +482,11 @@ restart: } else if (!err) { result = PyTuple_New(4); - if (result == NULL) + if (result == NULL) { + Py_XDECREF(s1); + Py_XDECREF(s2); return NULL; + } PyTuple_SET_ITEM(result, 0, PyInt_FromLong(what)); PyTuple_SET_ITEM(result, 2, PyInt_FromLong(fileno)); if (s1 == NULL)