X-Git-Url: http://git.samba.org/samba.git/?a=blobdiff_plain;f=source4%2Flib%2Fldb%2Fcommon%2Fldb_msg.c;fp=source4%2Flib%2Fldb%2Fcommon%2Fldb_msg.c;h=8cf2584413bc02af909ebbfd33bf024995df49e0;hb=31aeb841c9823574cb6f13986f4da34d00bb40a1;hp=a6430046051af72c9cbda6e50bfeb0fa8a7f2d12;hpb=1e20dbd8127bcecda8e4a656d326b391cc5c8e8d;p=ira%2Fwip.git diff --git a/source4/lib/ldb/common/ldb_msg.c b/source4/lib/ldb/common/ldb_msg.c index a6430046051..8cf2584413b 100644 --- a/source4/lib/ldb/common/ldb_msg.c +++ b/source4/lib/ldb/common/ldb_msg.c @@ -705,15 +705,17 @@ int ldb_msg_difference(struct ldb_context *ldb, mod->num_elements = 0; mod->elements = NULL; - /* canonicalize msg2 so we have no repeated elements */ - msg2 = ldb_msg_canonicalize(ldb, msg2); - if (msg2 == NULL) { + /* + * Canonicalize *msg2 so we have no repeated elements + * Resulting message is allocated in *mod's mem context, + * as we are going to move some elements from *msg2 to + * *mod object later + */ + ldb_res = ldb_msg_normalize(ldb, mod, msg2, &msg2); + if (ldb_res != LDB_SUCCESS) { goto failed; } - /* steal msg2 into mod context as it is allocated in ldb's context */ - talloc_steal(mod, msg2); - /* look in msg2 to find elements that need to be added or modified */ for (i=0;inum_elements;i++) { el = ldb_msg_find_element(msg1, msg2->elements[i].name);