From f6545be647f30114897dcc4837159b2fd507576b Mon Sep 17 00:00:00 2001 From: Unbit Date: Thu, 29 Aug 2013 14:45:08 +0200 Subject: [PATCH] fixed reference counting bug in rpc and signal handlers --- plugins/python/uwsgi_pymodule.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/python/uwsgi_pymodule.c b/plugins/python/uwsgi_pymodule.c index c4442b10..f2d2d5aa 100644 --- a/plugins/python/uwsgi_pymodule.c +++ b/plugins/python/uwsgi_pymodule.c @@ -394,6 +394,7 @@ PyObject *py_uwsgi_register_rpc(PyObject * self, PyObject * args) { return NULL; } + Py_INCREF(func); if (uwsgi_register_rpc(name, &python_plugin, argc, func)) { return PyErr_Format(PyExc_ValueError, "unable to register rpc function"); @@ -498,6 +499,8 @@ PyObject *py_uwsgi_register_signal(PyObject * self, PyObject * args) { return NULL; } + Py_INCREF(handler); + if (uwsgi_register_signal(uwsgi_signal, signal_kind, handler, 0)) { return PyErr_Format(PyExc_ValueError, "unable to register signal"); }