From 751bab4fb2478f4ce24f0b41c3c1a1b428892c1b Mon Sep 17 00:00:00 2001 From: Matthias Dieter Wallnöfer Date: Wed, 12 Oct 2011 20:17:33 +0200 Subject: s4:objectclass LDB module - objectclass modify op. - remove superflous "talloc_strdup" We are adding strings embedded in the schema structure which is basically global and lives longer than the request - hence no duplication needed. Reviewed-by: abartlet --- source4/dsdb/samdb/ldb_modules/objectclass.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'source4/dsdb/samdb') diff --git a/source4/dsdb/samdb/ldb_modules/objectclass.c b/source4/dsdb/samdb/ldb_modules/objectclass.c index c854d30cf1..89dd6efd8a 100644 --- a/source4/dsdb/samdb/ldb_modules/objectclass.c +++ b/source4/dsdb/samdb/ldb_modules/objectclass.c @@ -985,7 +985,6 @@ static int objectclass_do_mod(struct oc_context *ac) { struct ldb_context *ldb; struct ldb_request *mod_req; - char *value; struct ldb_message_element *oc_el_entry, *oc_el_change; struct ldb_val *vals; struct ldb_message *msg; @@ -1146,13 +1145,10 @@ static int objectclass_do_mod(struct oc_context *ac) /* Move from the linked list back into an ldb msg */ for (current = sorted; current; current = current->next) { - value = talloc_strdup(msg, - current->objectclass->lDAPDisplayName); - if (value == NULL) { - talloc_free(mem_ctx); - return ldb_module_oom(ac->module); - } - ret = ldb_msg_add_string(msg, "objectClass", value); + const char *objectclass_name = current->objectclass->lDAPDisplayName; + + ret = ldb_msg_add_string(msg, "objectClass", + objectclass_name); if (ret != LDB_SUCCESS) { ldb_set_errstring(ldb, "objectclass: could not re-add sorted objectclasses!"); -- cgit