From: Stefan Metzmacher Date: Mon, 13 Aug 2012 13:31:16 +0000 (+0200) Subject: s4:dsdb/repl: avoid reallocation of msg->elements X-Git-Tag: tevent-0.9.17~80 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d81d6afd6f0d661b836885f57ab397c1e905a90b;p=thirdparty%2Fsamba.git s4:dsdb/repl: avoid reallocation of msg->elements 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 --- 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);