From: Noel Power Date: Wed, 23 Jan 2019 18:08:58 +0000 (+0000) Subject: decref results of PyStr_FromString X-Git-Url: http://git.samba.org/?a=commitdiff_plain;h=e29c34942dcc29721f8f3dc8dbb58a18afda1e60;p=metze%2Fsamba%2Fwip.git decref results of PyStr_FromString Where we create temporary objects (which are added to containers) these objects already get there ref count incremented. In this case we need to decref those objects to ensure they are released. Signed-off-by: Noel Power Reviewed-by: Douglas Bagnall --- diff --git a/source4/param/provision.c b/source4/param/provision.c index 10a657b981be..ebcc0cd77da3 100644 --- a/source4/param/provision.c +++ b/source4/param/provision.c @@ -34,25 +34,34 @@ static PyObject *provision_module(void) { PyObject *name = PyStr_FromString("samba.provision"); + PyObject *mod = NULL; if (name == NULL) return NULL; - return PyImport_Import(name); + mod = PyImport_Import(name); + Py_CLEAR(name); + return mod; } static PyObject *schema_module(void) { PyObject *name = PyStr_FromString("samba.schema"); + PyObject *mod = NULL; if (name == NULL) return NULL; - return PyImport_Import(name); + mod = PyImport_Import(name); + Py_CLEAR(name); + return mod; } static PyObject *ldb_module(void) { PyObject *name = PyStr_FromString("ldb"); + PyObject *mod = NULL; if (name == NULL) return NULL; - return PyImport_Import(name); + mod = PyImport_Import(name); + Py_CLEAR(name); + return mod; } static PyObject *PyLdb_FromLdbContext(struct ldb_context *ldb_ctx)