diff --git a/lib/ldb/common/ldb_ldif.c b/lib/ldb/common/ldb_ldif.c index 2bd02663f09..c2f1cb7c970 100644 --- a/lib/ldb/common/ldb_ldif.c +++ b/lib/ldb/common/ldb_ldif.c @@ -772,7 +772,7 @@ struct ldb_ldif *ldb_ldif_read(struct ldb_context *ldb, ldif = talloc(ldb, struct ldb_ldif); if (!ldif) return NULL; - ldif->msg = talloc(ldif, struct ldb_message); + ldif->msg = ldb_msg_new(ldif); if (ldif->msg == NULL) { talloc_free(ldif); return NULL; @@ -781,10 +781,6 @@ struct ldb_ldif *ldb_ldif_read(struct ldb_context *ldb, ldif->changetype = LDB_CHANGETYPE_NONE; msg = ldif->msg; - msg->dn = NULL; - msg->elements = NULL; - msg->num_elements = 0; - chunk = next_chunk(ldb, ldif, fgetc_fn, private_data); if (!chunk) { goto failed; diff --git a/lib/ldb/tools/ldbdump.c b/lib/ldb/tools/ldbdump.c index a466e4916db..eb237e89b44 100644 --- a/lib/ldb/tools/ldbdump.c +++ b/lib/ldb/tools/ldbdump.c @@ -40,7 +40,7 @@ static int traverse_fn(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA _dbuf, void *sta { int ret, i, j; struct ldb_dn *dn = state; - struct ldb_message *msg = talloc_zero(NULL, struct ldb_message); + struct ldb_message *msg = ldb_msg_new(NULL); struct ldb_val dbuf = { .data = _dbuf.dptr, .length = _dbuf.dsize,