From d81d6afd6f0d661b836885f57ab397c1e905a90b Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 13 Aug 2012 15:31:16 +0200 Subject: [PATCH] s4:dsdb/repl: avoid reallocation of msg->elements MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The index into the elements needs to match between msg->elements and md->ctr.ctr1.array, which means we should pre-allocate them with the same size. Pair-Programmed-With: Björn Baumbach metze --- source4/dsdb/repl/replicated_objects.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source4/dsdb/repl/replicated_objects.c b/source4/dsdb/repl/replicated_objects.c index 564befe2c17..cd664e3656e 100644 --- a/source4/dsdb/repl/replicated_objects.c +++ b/source4/dsdb/repl/replicated_objects.c @@ -258,7 +258,7 @@ WERROR dsdb_convert_object_ex(struct ldb_context *ldb, msg->num_elements = in->object.attribute_ctr.num_attributes; msg->elements = talloc_array(msg, struct ldb_message_element, - msg->num_elements); + msg->num_elements + 1); /* +1 because of the RDN attribute */ W_ERROR_HAVE_NO_MEMORY(msg->elements); md = talloc(mem_ctx, struct replPropertyMetaDataBlob); -- 2.11.4.GIT