summaryrefslogtreecommitdiff
path: root/source4/lib/ldb
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib/ldb')
-rw-r--r--source4/lib/ldb/pyldb.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/source4/lib/ldb/pyldb.c b/source4/lib/ldb/pyldb.c
index ce38e06638..8e7ba4df90 100644
--- a/source4/lib/ldb/pyldb.c
+++ b/source4/lib/ldb/pyldb.c
@@ -1677,18 +1677,22 @@ static PyObject *py_ldb_msg_new(PyTypeObject *type, PyObject *args, PyObject *kw
return NULL;
}
- if (pydn != NULL)
- if (!PyObject_AsDn(NULL, pydn, NULL, &ret->dn))
+ if (pydn != NULL) {
+ if (!PyObject_AsDn(NULL, pydn, NULL, &ret->dn)) {
+ talloc_free(ret);
return NULL;
+ }
+ }
py_ret = (PyLdbMessageObject *)type->tp_alloc(type, 0);
if (py_ret == NULL) {
PyErr_NoMemory();
+ talloc_free(ret);
return NULL;
}
py_ret->mem_ctx = talloc_new(NULL);
- py_ret->msg = talloc_reference(py_ret->mem_ctx, ret);
+ py_ret->msg = talloc_steal(py_ret->mem_ctx, ret);
return (PyObject *)py_ret;
}