diff options
author | Noel Power <noel.power@suse.com> | 2019-01-23 18:08:58 +0000 |
---|---|---|
committer | Noel Power <npower@samba.org> | 2019-02-07 13:44:30 +0100 |
commit | e29c34942dcc29721f8f3dc8dbb58a18afda1e60 (patch) | |
tree | e24953b3049c1b741b4ea6cd27c36ee5c136e5ab /source4/param | |
parent | 85b7574b91f3dfcf751de8ae81876dc64fc5e686 (diff) | |
download | samba-e29c34942dcc29721f8f3dc8dbb58a18afda1e60.tar.gz |
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 <noel.power@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Diffstat (limited to 'source4/param')
-rw-r--r-- | source4/param/provision.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/source4/param/provision.c b/source4/param/provision.c index 10a657b981b..ebcc0cd77da 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) |