mirror of
https://github.com/samba-team/samba.git
synced 2025-02-02 09:47:23 +03:00
plydb: Keep talloc_reference() to the DN in PyDict_AsMessage
Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
This commit is contained in:
parent
37327afd0a
commit
287cf82682
@ -1425,16 +1425,23 @@ static struct ldb_message *PyDict_AsMessage(TALLOC_CTX *mem_ctx,
|
||||
}
|
||||
|
||||
if (dn_value) {
|
||||
if (!pyldb_Object_AsDn(msg, dn_value, ldb_ctx, &msg->dn)) {
|
||||
struct ldb_dn *dn = NULL;
|
||||
if (!pyldb_Object_AsDn(msg, dn_value, ldb_ctx, &dn)) {
|
||||
PyErr_SetString(PyExc_TypeError, "unable to import dn object");
|
||||
TALLOC_FREE(msg);
|
||||
return NULL;
|
||||
}
|
||||
if (msg->dn == NULL) {
|
||||
if (dn == NULL) {
|
||||
PyErr_SetString(PyExc_TypeError, "dn set but not found");
|
||||
TALLOC_FREE(msg);
|
||||
return NULL;
|
||||
}
|
||||
msg->dn = talloc_reference(msg, dn);
|
||||
if (msg->dn == NULL) {
|
||||
talloc_free(mem_ctx);
|
||||
PyErr_NoMemory();
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
PyErr_SetString(PyExc_TypeError, "no dn set");
|
||||
TALLOC_FREE(msg);
|
||||
|
Loading…
x
Reference in New Issue
Block a user