From: Stefan Krah <skrah@bytereef.org>
Date: Mon, 27 Feb 2012 12:51:02 +0000 (+0100)
Subject: Issue #14125: Fix multiprocessing refleak on Windows. Patch by sbt.
X-Git-Tag: v3.3.0a1~46
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a03422f5d3a0780bfde5e4aa7ee05e1eb9a090fd;p=python

Issue #14125: Fix multiprocessing refleak on Windows. Patch by sbt.
---

diff --git a/Modules/_multiprocessing/win32_functions.c b/Modules/_multiprocessing/win32_functions.c
index e1759971cb..15aeedae33 100644
--- a/Modules/_multiprocessing/win32_functions.c
+++ b/Modules/_multiprocessing/win32_functions.c
@@ -708,9 +708,12 @@ win32_WaitForMultipleObjects(PyObject* self, PyObject* args)
         PyObject *v = PySequence_GetItem(handle_seq, i);
         if (v == NULL)
             return NULL;
-        if (!PyArg_Parse(v, F_HANDLE, &h))
+        if (!PyArg_Parse(v, F_HANDLE, &h)) {
+            Py_DECREF(v);
             return NULL;
+        }
         handles[i] = h;
+        Py_DECREF(v);
     }
     /* If this is the main thread then make the wait interruptible
        by Ctrl-C unless we are waiting for *all* handles */