]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: contrib/spoa-server: Ensure ip address references are freed
authorGilchrist Dadaglo <dadaglo@amazon.com>
Mon, 24 Aug 2020 19:21:32 +0000 (19:21 +0000)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 1 Sep 2020 16:28:21 +0000 (18:28 +0200)
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.

contrib/spoa_server/ps_python.c

index 3ad64a7a7c381739e49102b87670112a0d5b434b..427ef18ee0eef8cbc76859c7c3f1d06dd31ba0cb 100644 (file)
@@ -244,6 +244,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;
 }
 
@@ -279,6 +281,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;
 }