mirror of
https://github.com/haproxy/haproxy.git
synced 2026-04-15 21:59:41 -04:00
BUG/MAJOR: contrib/spoa-server: Fix unhandled python call leading to memory leak
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 This patch must be backported as far as 2.0.
This commit is contained in:
parent
ae2132cffb
commit
222f060be3
1 changed files with 4 additions and 0 deletions
|
|
@ -738,10 +738,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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue