mirror of
https://github.com/opencv/opencv.git
synced 2024-11-24 19:20:28 +08:00
Fix memory leak in Python custom dnn layers
This commit is contained in:
parent
71ec112093
commit
7f0d90a525
@ -160,12 +160,13 @@ public:
|
||||
PyObject* args = pyopencv_from(inputs);
|
||||
PyObject* res = PyObject_CallMethodObjArgs(o, PyString_FromString("forward"), args, NULL);
|
||||
Py_DECREF(args);
|
||||
PyGILState_Release(gstate);
|
||||
if (!res)
|
||||
CV_Error(Error::StsNotImplemented, "Failed to call \"forward\" method");
|
||||
|
||||
std::vector<Mat> pyOutputs;
|
||||
CV_Assert(pyopencv_to(res, pyOutputs, ArgInfo("", 0)));
|
||||
Py_DECREF(res);
|
||||
PyGILState_Release(gstate);
|
||||
|
||||
CV_Assert(pyOutputs.size() == outputs.size());
|
||||
for (size_t i = 0; i < outputs.size(); ++i)
|
||||
|
Loading…
Reference in New Issue
Block a user