fix memory leak
This commit is contained in:
parent
c6067b90c1
commit
5559dbb9ed
|
@ -206,6 +206,7 @@ impl PyObject {
|
|||
let ptr = ffi::PyObject_GetAttr(self.as_ptr(), name);
|
||||
let result = PyObject::from_borrowed_ptr_or_err(
|
||||
py, ffi::PyObject_Call(ptr, t.as_ptr(), kwargs.as_ptr()));
|
||||
ffi::Py_DECREF(ptr);
|
||||
py.release(t);
|
||||
result
|
||||
})
|
||||
|
|
|
@ -267,6 +267,7 @@ impl<T> ObjectProtocol for T where T: PyObjectWithToken + ToPyPointer {
|
|||
let ptr = ffi::PyObject_GetAttr(self.as_ptr(), name);
|
||||
let result = self.py().cast_from_borrowed_ptr_or_err(
|
||||
ffi::PyObject_Call(ptr, t.as_ptr(), kwargs.as_ptr()));
|
||||
ffi::Py_DECREF(ptr);
|
||||
self.py().release(t);
|
||||
result
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue