[Python-checkins] [2.7] bpo-36212: Fix two possible reference leaks in the hotshot module (GH-12327)
Victor Stinner
webhook-mailer at python.org
Thu Mar 14 11:11:08 EDT 2019
https://github.com/python/cpython/commit/2832ad53358e3fbc4bdc601b9f3fa04dd0deae46
commit: 2832ad53358e3fbc4bdc601b9f3fa04dd0deae46
branch: 2.7
author: stratakis <cstratak at redhat.com>
committer: Victor Stinner <vstinner at redhat.com>
date: 2019-03-14T16:10:58+01:00
summary:
[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.
files:
A Misc/NEWS.d/next/Library/2019-03-14-14-40-22.bpo-36212.IEgRI8.rst
M Modules/_hotshot.c
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 @@ logreader_tp_iternext(LogReaderObject *self)
}
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)
More information about the Python-checkins
mailing list