/*
canonicalise a message, merging elements of the same name
+
+ NOTE: Returned message will be allocated into NULL memory
+ context. It is strongly advised for callers to steal
+ the message returned into a local memory context.
+ Allocating ldb_msg into NULL context should appear
+ as memory leak (kind of) and thus make it easier to identify
+ places where ldb_msg_canonicalize() is misused
*/
struct ldb_message *ldb_msg_canonicalize(struct ldb_context *ldb,
const struct ldb_message *msg)
unsigned int i;
struct ldb_message *msg2;
- msg2 = ldb_msg_copy(ldb, msg);
- if (msg2 == NULL) return NULL;
+ msg2 = ldb_msg_copy(NULL, msg);
+ if (msg2 == NULL) {
+ return NULL;
+ }
ldb_msg_sort_elements(msg2);