summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2017-07-24 12:12:17 -0700
committerJeremy Allison <jra@samba.org>2017-07-26 21:35:22 +0200
commit99e4bea89e82327e6de3adf7e8411eb9a89f54db (patch)
tree31e8026160b09153d2f6e520b6911240abc80f28 /lib
parent41b1f8a20c7db6b79706a4aebcc7074149a6ab62 (diff)
downloadsamba-99e4bea89e82327e6de3adf7e8411eb9a89f54db.tar.gz
lib: ldb: Python. Take care of freeing the passed in module description if ldb_register_module() fails.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12932 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/ldb/pyldb.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/ldb/pyldb.c b/lib/ldb/pyldb.c
index b65e25525ad..515a69e6981 100644
--- a/lib/ldb/pyldb.c
+++ b/lib/ldb/pyldb.c
@@ -3949,7 +3949,7 @@ static PyObject *py_register_module(PyObject *module, PyObject *args)
if (!PyArg_ParseTuple(args, "O", &input))
return NULL;
- ops = talloc_zero(talloc_autofree_context(), struct ldb_module_ops);
+ ops = talloc_zero(NULL, struct ldb_module_ops);
if (ops == NULL) {
PyErr_NoMemory();
return NULL;
@@ -3972,6 +3972,9 @@ static PyObject *py_register_module(PyObject *module, PyObject *args)
ops->del_transaction = py_module_del_transaction;
ret = ldb_register_module(ops);
+ if (ret != LDB_SUCCESS) {
+ TALLOC_FREE(ops);
+ }
PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ret, NULL);