PREVIEW: Steal ldb_msg into short-lifetime context.
authorKamen Mazdrashki <kamenim@samba.org>
Sun, 4 Jul 2010 19:16:45 +0000 (22:16 +0300)
committerKamen Mazdrashki <kamenim@samba.org>
Sun, 4 Jul 2010 19:36:20 +0000 (22:36 +0300)
source4/dsdb/schema/schema_set.c
source4/lib/ldb/common/ldb_msg.c
source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c

index 1dcb4f89d50b435f5c8ab37095816a1d6466e30d..68209870de64dc16c300e8391127bba5ce8762fb 100644 (file)
@@ -686,6 +686,7 @@ WERROR dsdb_set_schema_from_ldif(struct ldb_context *ldb, const char *pf, const
                if (!msg) {
                        goto nomem;
                }
+               talloc_steal(mem_ctx, msg);
 
                status = dsdb_schema_set_el_from_ldb_msg(ldb, schema, msg);
                talloc_free(ldif);
index 29bdabcdd99bde0f47230ec5161c4ae55c704f8c..b7eccb1cdea3940ae77951d030145d09e1c934cc 100644 (file)
@@ -617,6 +617,7 @@ struct ldb_message *ldb_msg_diff(struct ldb_context *ldb,
                talloc_free(mod);
                return NULL;
        }
+       talloc_steal(mod, msg2);
        
        /* look in msg2 to find elements that need to be added
           or modified */
index 12af9c54504f6f7e007eb968142a5ee775e5ede2..f9d231b4f1065ad4f5087c98dad2a3027fe8eb75 100644 (file)
@@ -689,6 +689,7 @@ static int lsqlite3_search_callback(void *result, int col_num, char **cols, char
                if (ac->current_eid != 0) {
                        msg = ldb_msg_canonicalize(ldb, msg);
                        if (!msg) return SQLITE_ABORT;
+                       talloc_steal(ac->req, msg);
 
                        ret = ldb_module_send_entry(ac->req, msg, NULL);
                        if (ret != LDB_SUCCESS) {
@@ -964,6 +965,7 @@ int lsql_search(struct lsql_context *ctx)
                if (ctx->ares->message == NULL) {
                        return LDB_ERR_OPERATIONS_ERROR;
                }
+               talloc_steal(ac->req, msg);
 
                ret = ldb_module_send_entry(req, ctx->ares->message, NULL);
                if (ret != LDB_SUCCESS) {