1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-01 04:58:35 +03:00

pyldb: Fix memory leak of LdbMessage's created from Python.

This commit is contained in:
Jelmer Vernooij 2009-06-17 19:01:06 +02:00
parent d4172bbcc5
commit 0c16676642

View File

@ -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;
}