s4-test: Use ldb_msg_canonicalize_ex() in sqlite3 backend
authorKamen Mazdrashki <kamenim@samba.org>
Sat, 10 Jul 2010 00:32:16 +0000 (03:32 +0300)
committerKamen Mazdrashki <kamenim@samba.org>
Sat, 10 Jul 2010 20:03:15 +0000 (23:03 +0300)
source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c

index 12af9c54504f6f7e007eb968142a5ee775e5ede2..7a5a9d6d4ca7fc979ae41276ae32dbf1f0515839 100644 (file)
@@ -687,14 +687,22 @@ static int lsqlite3_search_callback(void *result, int col_num, char **cols, char
                /* call the async callback for the last entry
                 * except the first time */
                if (ac->current_eid != 0) {
-                       msg = ldb_msg_canonicalize(ldb, msg);
-                       if (!msg) return SQLITE_ABORT;
+                       ret = ldb_msg_canonicalize_ex(ldb, msg,
+                                                     (TALLOC_CTX*)ac->req, &msg);
+                       if (ret != LDB_SUCCESS) {
+                               return SQLITE_ABORT;
+                       }
 
                        ret = ldb_module_send_entry(ac->req, msg, NULL);
                        if (ret != LDB_SUCCESS) {
                                ac->callback_failed = true;
+                               /* free msg object */
+                               TALLOC_FREE(msg);
                                return SQLITE_ABORT;
                        }
+
+                       /* free msg object */
+                       TALLOC_FREE(msg);
                }
 
                /* start over */
@@ -960,8 +968,9 @@ int lsql_search(struct lsql_context *ctx)
 
        /* complete the last message if any */
        if (ctx->ares) {
-               ctx->ares->message = ldb_msg_canonicalize(ldb, ctx->ares->message);
-               if (ctx->ares->message == NULL) {
+               ret = ldb_msg_canonicalize_ex(ldb, ctx->ares->message,
+                                             (TALLOC_CTX*)ctx->ares, &ctx->ares->message);
+               if (ret != LDB_SUCCESS) {
                        return LDB_ERR_OPERATIONS_ERROR;
                }