s4-dsdb: use ldb_msg_canonicalize_ex() in ldb_msg_diff_ex()
authorKamen Mazdrashki <kamenim@samba.org>
Sat, 10 Jul 2010 00:13:54 +0000 (03:13 +0300)
committerKamen Mazdrashki <kamenim@samba.org>
Sat, 10 Jul 2010 20:03:15 +0000 (23:03 +0300)
source4/lib/ldb/common/ldb_msg.c

index ae5bc2e3abe808720f6d16c13134686869ab8419..806f0e872d5613b1e2469429103508e849312b1d 100644 (file)
@@ -725,17 +725,15 @@ int ldb_msg_diff_ex(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_canonicalize_ex(ldb, msg2, (TALLOC_CTX*)mod, &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;i<msg2->num_elements;i++) {