summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2007-11-16 04:18:22 +0100
committerStefan Metzmacher <metze@samba.org>2007-12-21 05:45:27 +0100
commit579eca54b738fb2f78bc994cee8632dbf94c5a2d (patch)
treebbbc660ecff0ef6d1df793e410f6c4c3e1736817
parentd7e5d3fe27a066b5e394129b16e02c9793b73231 (diff)
downloadsamba-579eca54b738fb2f78bc994cee8632dbf94c5a2d.tar.gz
samba-579eca54b738fb2f78bc994cee8632dbf94c5a2d.tar.bz2
samba-579eca54b738fb2f78bc994cee8632dbf94c5a2d.zip
r25981: Don't create an ldb_request on NULL.
A re-arrangment of the code due to the base DN checking meant that the ac->down_req array wasn't started, so was NULL Andrew Bartlett (This used to be commit 0a44b8e9f3e1a85c27d105cdd1572a0df936f612)
-rw-r--r--source4/dsdb/samdb/ldb_modules/linked_attributes.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/linked_attributes.c b/source4/dsdb/samdb/ldb_modules/linked_attributes.c
index f3e66c5065..fd36c16d56 100644
--- a/source4/dsdb/samdb/ldb_modules/linked_attributes.c
+++ b/source4/dsdb/samdb/ldb_modules/linked_attributes.c
@@ -127,8 +127,18 @@ static int setup_modifies(struct ldb_context *ldb, TALLOC_CTX *mem_ctx,
for (j=0; j < el->num_values; j++) {
struct ldb_message_element *ret_el;
struct ldb_request *new_req;
+ struct ldb_message *new_msg;
+
+ /* Create a spot in the list for the requests */
+ ac->down_req = talloc_realloc(ac, ac->down_req,
+ struct ldb_request *, ac->num_requests + 1);
+ if (!ac->down_req) {
+ ldb_oom(ldb);
+ return LDB_ERR_OPERATIONS_ERROR;
+ }
+
/* Create the modify request */
- struct ldb_message *new_msg = ldb_msg_new(ac->down_req);
+ new_msg = ldb_msg_new(ac->down_req);
if (!new_msg) {
ldb_oom(ldb);
return LDB_ERR_OPERATIONS_ERROR;
@@ -184,13 +194,6 @@ static int setup_modifies(struct ldb_context *ldb, TALLOC_CTX *mem_ctx,
ldb_set_timeout_from_prev_req(ldb, ac->orig_req, new_req);
- /* Now add it to the list */
- ac->down_req = talloc_realloc(ac, ac->down_req,
- struct ldb_request *, ac->num_requests + 1);
- if (!ac->down_req) {
- ldb_oom(ldb);
- return LDB_ERR_OPERATIONS_ERROR;
- }
ac->down_req[ac->num_requests] = new_req;
ac->num_requests++;