summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>2019-04-15 23:20:46 +1200
committerAndrew Bartlett <abartlet@samba.org>2019-05-10 01:15:17 +0000
commit4624957d42fdd0cbefd0f1e8298b7a19439fe004 (patch)
tree987fbcda259e595bfd06844ab71ea2eddc1fabe9 /source4
parent8f081b7f78bc2c6e60f869423bae15aa0adfa800 (diff)
downloadsamba-4624957d42fdd0cbefd0f1e8298b7a19439fe004.tar.gz
s4: use ldb_msg_new(), not talloc/talloc_zero
ldb_msg_new() is currently the same as talloc_zero(), but it might not always be. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4')
-rw-r--r--source4/dsdb/samdb/ldb_modules/dirsync.c2
-rw-r--r--source4/ldap_server/ldap_backend.c4
-rw-r--r--source4/lib/registry/ldb.c4
3 files changed, 4 insertions, 6 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/dirsync.c b/source4/dsdb/samdb/ldb_modules/dirsync.c
index 0d46e2a6254..74a107c8476 100644
--- a/source4/dsdb/samdb/ldb_modules/dirsync.c
+++ b/source4/dsdb/samdb/ldb_modules/dirsync.c
@@ -150,7 +150,7 @@ static int dirsync_filter_entry(struct ldb_request *req,
* list only the attribute that have been modified since last interogation
*
*/
- newmsg = talloc_zero(dsc->req, struct ldb_message);
+ newmsg = ldb_msg_new(dsc->req);
if (newmsg == NULL) {
return ldb_oom(ldb);
}
diff --git a/source4/ldap_server/ldap_backend.c b/source4/ldap_server/ldap_backend.c
index 39f1aa2a2a6..9f72734f973 100644
--- a/source4/ldap_server/ldap_backend.c
+++ b/source4/ldap_server/ldap_backend.c
@@ -799,12 +799,10 @@ static NTSTATUS ldapsrv_ModifyRequest(struct ldapsrv_call *call)
DEBUG(10, ("ModifyRequest: dn: [%s]\n", req->dn));
- msg = talloc(local_ctx, struct ldb_message);
+ msg = ldb_msg_new(local_ctx);
NT_STATUS_HAVE_NO_MEMORY(msg);
msg->dn = dn;
- msg->num_elements = 0;
- msg->elements = NULL;
if (req->num_mods > 0) {
msg->num_elements = req->num_mods;
diff --git a/source4/lib/registry/ldb.c b/source4/lib/registry/ldb.c
index ec293c46149..d0e9f46f4e1 100644
--- a/source4/lib/registry/ldb.c
+++ b/source4/lib/registry/ldb.c
@@ -142,7 +142,7 @@ static struct ldb_message *reg_ldb_pack_value(struct ldb_context *ctx,
char *name_dup, *type_str;
int ret;
- msg = talloc_zero(mem_ctx, struct ldb_message);
+ msg = ldb_msg_new(mem_ctx);
if (msg == NULL) {
return NULL;
}
@@ -658,7 +658,7 @@ static WERROR ldb_del_value(TALLOC_CTX *mem_ctx, struct hive_key *key,
if (child[0] == '\0') {
/* default value */
- msg = talloc_zero(mem_ctx, struct ldb_message);
+ msg = ldb_msg_new(mem_ctx);
W_ERROR_HAVE_NO_MEMORY(msg);
msg->dn = ldb_dn_copy(msg, kd->dn);
W_ERROR_HAVE_NO_MEMORY(msg->dn);