]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[2.7] bpo-36212: Fix two possible reference leaks in the hotshot module (GH-12327)
authorstratakis <cstratak@redhat.com>
Thu, 14 Mar 2019 15:10:58 +0000 (16:10 +0100)
committerVictor Stinner <vstinner@redhat.com>
Thu, 14 Mar 2019 15:10:58 +0000 (16:10 +0100)
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 [new file with mode: 0644]
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 (file)
index 0000000..b2d2642
--- /dev/null
@@ -0,0 +1 @@
+Fix two possible reference leaks in the hotshot module.
index 33cd38da2ffe4c5da580fb747081ba4475952e35..4fc5cee479e567944c10000d7c9a9b702a1ff619 100644 (file)
@@ -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)