From 2832ad53358e3fbc4bdc601b9f3fa04dd0deae46 Mon Sep 17 00:00:00 2001 From: stratakis Date: Thu, 14 Mar 2019 16:10:58 +0100 Subject: [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. --- Misc/NEWS.d/next/Library/2019-03-14-14-40-22.bpo-36212.IEgRI8.rst | 1 + Modules/_hotshot.c | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 Misc/NEWS.d/next/Library/2019-03-14-14-40-22.bpo-36212.IEgRI8.rst 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 0000000..b2d2642 --- /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 33cd38d..4fc5cee 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) -- cgit v0.12