Fix a leak described in issue #11205
authorDan Mašek <dan.masek@gmail.com>
Tue, 3 Apr 2018 01:02:21 +0000 (03:02 +0200)
committerDan Mašek <dan.masek@gmail.com>
Tue, 3 Apr 2018 01:02:21 +0000 (03:02 +0200)
modules/python/src2/cv2.cpp

index fab60fd..b825ca9 100644 (file)
@@ -1584,6 +1584,8 @@ static void OnChange(int pos, void *param)
     PyObject *r = PyObject_Call(PyTuple_GetItem(o, 0), args, NULL);
     if (r == NULL)
         PyErr_Print();
+    else
+        Py_DECREF(r);
     Py_DECREF(args);
     PyGILState_Release(gstate);
 }
@@ -1626,6 +1628,8 @@ static void OnButtonChange(int state, void *param)
     PyObject *r = PyObject_Call(PyTuple_GetItem(o, 0), args, NULL);
     if (r == NULL)
         PyErr_Print();
+    else
+        Py_DECREF(r);
     Py_DECREF(args);
     PyGILState_Release(gstate);
 }