diff options
author | Noel Power <noel.power@suse.com> | 2019-01-23 15:15:07 +0000 |
---|---|---|
committer | Noel Power <npower@samba.org> | 2019-02-07 13:44:30 +0100 |
commit | 53d973f59c3514f9c288cc8e53a682176a5fc415 (patch) | |
tree | 99b0ff693f19501d46585f76533ec50dec769fa8 /lib/ldb-samba | |
parent | 1be9b0cf1bc95715e83c27eabecbd4fa2022530b (diff) | |
download | samba-53d973f59c3514f9c288cc8e53a682176a5fc415.tar.gz |
Cleanup references to module objects returned from PyImport_ImportModule
Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Diffstat (limited to 'lib/ldb-samba')
-rw-r--r-- | lib/ldb-samba/pyldb.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/ldb-samba/pyldb.c b/lib/ldb-samba/pyldb.c index 57c5397bc06..0cf550bc7a5 100644 --- a/lib/ldb-samba/pyldb.c +++ b/lib/ldb-samba/pyldb.c @@ -180,8 +180,10 @@ static PyObject *py_ldb_set_session_info(PyObject *self, PyObject *args) return NULL; PyAuthSession_Type = PyObject_GetAttrString(mod_samba_auth, "session_info"); - if (PyAuthSession_Type == NULL) + if (PyAuthSession_Type == NULL) { + Py_CLEAR(mod_samba_auth); return NULL; + } ret = PyArg_ParseTuple(args, "O!", PyAuthSession_Type, &py_session_info); @@ -262,11 +264,15 @@ MODULE_INIT_FUNC(_ldb) return NULL; PySambaLdb.tp_base = (PyTypeObject *)PyObject_GetAttrString(pyldb_module, "Ldb"); - if (PySambaLdb.tp_base == NULL) + if (PySambaLdb.tp_base == NULL) { + Py_CLEAR(pyldb_module); return NULL; + } py_ldb_error = PyObject_GetAttrString(pyldb_module, "LdbError"); + Py_CLEAR(pyldb_module); + if (PyType_Ready(&PySambaLdb) < 0) return NULL; |