From: Gilchrist Dadaglo <[email protected]>
The result from spoa evaluation of the user provided python code is
never passed back to the main spoa process nor freed.
Same for the keyword list passed.
This results into the elements never freed by Python as reference count
never goes down.
https://docs.python.org/3/extending/extending.html#reference-counting-in-python
---
contrib/spoa_server/ps_python.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/contrib/spoa_server/ps_python.c b/contrib/spoa_server/ps_python.c
index 8f002eb..2cc97e3 100644
--- a/contrib/spoa_server/ps_python.c
+++ b/contrib/spoa_server/ps_python.c
@@ -733,10 +733,14 @@ static int ps_python_exec_message(struct worker *w, void
*ref, int nargs, struct
}
result = PyObject_Call(python_ref, empty_array, fkw);
+ Py_DECREF(fkw);
if (result == NULL) {
PyErr_Print();
return 0;
}
+ if (result != Py_None) {
+ Py_DECREF(result);
+ }
return 1;
}
--
2.24.3.AMZN