From: Gilchrist Dadaglo Date: Mon, 24 Aug 2020 19:21:32 +0000 (+0000) Subject: BUG/MINOR: contrib/spoa-server: Ensure ip address references are freed X-Git-Tag: v2.1.9~36 X-Git-Url: http://git.haproxy.org/?a=commitdiff_plain;h=ccf6e2dcc1e20aac018287ae343c58315ede0e04;p=haproxy-2.1.git BUG/MINOR: contrib/spoa-server: Ensure ip address references are freed IP addresses references passed in argument for ps_python are not freed after they have been used. Leading to a small chance of mem leak if a lot of ip addresses are passed around This patch must be backported as far as 2.0. (cherry picked from commit 9f0c984cf50fee3a2282993b573be2f049efe5ab) Signed-off-by: Christopher Faulet (cherry picked from commit a77f10426189fe48bca2c3543e65510933b95272) Signed-off-by: Christopher Faulet --- diff --git a/contrib/spoa_server/ps_python.c b/contrib/spoa_server/ps_python.c index c1e2bac..a8e751f 100644 --- a/contrib/spoa_server/ps_python.c +++ b/contrib/spoa_server/ps_python.c @@ -180,6 +180,8 @@ static PyObject *ps_python_set_var_ipv4(PyObject *self, PyObject *args) PyErr_SetString(spoa_error, "No space left available"); return NULL; } + /* Once we set the IP value in the worker, we don't need it anymore... */ + Py_XDECREF(value); return Py_None; } @@ -211,6 +213,8 @@ static PyObject *ps_python_set_var_ipv6(PyObject *self, PyObject *args) PyErr_SetString(spoa_error, "No space left available"); return NULL; } + /* Once we set the IP value in the worker, we don't need it anymore... */ + Py_XDECREF(value); return Py_None; }