summaryrefslogtreecommitdiff
path: root/source4/lib/ldb
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>2009-11-15 14:23:32 +0100
committerMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>2009-11-15 14:26:41 +0100
commitcc080742bd29d56f863abcb33f26d1719dacaaf7 (patch)
tree3921eb36cfd9f6c15fd2193817979698b0e22015 /source4/lib/ldb
parent6cf43db7fc3e2eea2cd72a026b8cd20012387e12 (diff)
downloadsamba-cc080742bd29d56f863abcb33f26d1719dacaaf7.tar.gz
samba-cc080742bd29d56f863abcb33f26d1719dacaaf7.tar.bz2
samba-cc080742bd29d56f863abcb33f26d1719dacaaf7.zip
ldb:python bindings - add a context on "py_ldb_delete"
So the converted DN will be freed after usage.
Diffstat (limited to 'source4/lib/ldb')
-rw-r--r--source4/lib/ldb/pyldb.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/source4/lib/ldb/pyldb.c b/source4/lib/ldb/pyldb.c
index 901d121ff6..1f1dcf8e31 100644
--- a/source4/lib/ldb/pyldb.c
+++ b/source4/lib/ldb/pyldb.c
@@ -783,15 +783,23 @@ static PyObject *py_ldb_delete(PyLdbObject *self, PyObject *args)
struct ldb_dn *dn;
int ret;
struct ldb_context *ldb;
+ TALLOC_CTX *mem_ctx;
if (!PyArg_ParseTuple(args, "O", &py_dn))
return NULL;
+ mem_ctx = talloc_new(NULL);
+ if (mem_ctx == NULL) {
+ PyErr_NoMemory();
+ return NULL;
+ }
ldb = PyLdb_AsLdbContext(self);
-
- if (!PyObject_AsDn(NULL, py_dn, ldb, &dn))
+ if (!PyObject_AsDn(mem_ctx, py_dn, ldb, &dn)) {
+ talloc_free(mem_ctx);
return NULL;
+ }
ret = ldb_delete(ldb, dn);
+ talloc_free(mem_ctx);
PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ret, ldb);
Py_RETURN_NONE;