summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorMatthieu Patou <mat@matws.net>2011-02-26 21:35:27 +0300
committerMatthieu Patou <mat@samba.org>2011-03-20 12:13:50 +0100
commitdef1fcb089d222cca44c016d976df38680539a0d (patch)
tree601807f7f3df30109b61e1dc685595806b3124d8 /source4
parent88d907189ce00a5ab509bdbe8a528ab493a4f6f8 (diff)
downloadsamba-def1fcb089d222cca44c016d976df38680539a0d.tar.gz
samba-def1fcb089d222cca44c016d976df38680539a0d.tar.bz2
samba-def1fcb089d222cca44c016d976df38680539a0d.zip
pyldb: minor fixup, fix a memory leak
Autobuild-User: Matthieu Patou <mat@samba.org> Autobuild-Date: Sun Mar 20 12:13:50 CET 2011 on sn-devel-104
Diffstat (limited to 'source4')
-rw-r--r--source4/lib/ldb/pyldb.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/source4/lib/ldb/pyldb.c b/source4/lib/ldb/pyldb.c
index d14487ba02..5fcc5a64b6 100644
--- a/source4/lib/ldb/pyldb.c
+++ b/source4/lib/ldb/pyldb.c
@@ -85,6 +85,7 @@ static void py_ldb_control_dealloc(PyLdbControlObject *self)
if (self->mem_ctx != NULL) {
talloc_free(self->mem_ctx);
}
+ self->data = NULL;
self->ob_type->tp_free(self);
}
@@ -111,7 +112,6 @@ static PyObject *py_ldb_control_set_critical(PyLdbControlObject *self, PyObject
static PyObject *py_ldb_control_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
{
char *data = NULL;
- const char *array[2];
const char * const kwnames[] = { "ldb", "data", NULL };
struct ldb_control *parsed_controls;
PyLdbControlObject *ret;
@@ -148,7 +148,7 @@ static PyObject *py_ldb_control_new(PyTypeObject *type, PyObject *args, PyObject
ret->mem_ctx = mem_ctx;
- ret->data = talloc_steal(mem_ctx, parsed_controls);
+ ret->data = talloc_move(mem_ctx, &parsed_controls);
if (ret->data == NULL) {
Py_DECREF(ret);
PyErr_NoMemory();
@@ -209,6 +209,7 @@ static PyObject *PyLdbControl_FromControl(struct ldb_control *control)
ctrl = (PyLdbControlObject *)PyLdbControl.tp_alloc(&PyLdbControl, 0);
if (ctrl == NULL) {
+ talloc_free(ctl_ctx);
PyErr_NoMemory();
return NULL;
}