s4-samdb: free the linked_attributes list on prepare commit failure
authorAndrew Tridgell <tridge@samba.org>
Fri, 25 Sep 2009 22:12:52 +0000 (15:12 -0700)
committerAndrew Tridgell <tridge@samba.org>
Mon, 28 Sep 2009 00:23:56 +0000 (10:23 +1000)
source4/dsdb/samdb/ldb_modules/linked_attributes.c

index b4144efe3f0637963da3cabe553dbb848dac1678..0bb9ecc7ed603348ccc1815ce42e79b7d396578c 100644 (file)
@@ -1212,6 +1212,8 @@ static int linked_attributes_prepare_commit(struct ldb_module *module)
                talloc_get_type(ldb_module_get_private(module), struct la_private);
        struct la_context *ac;
 
+       DEBUG(0,(__location__ ": prepare commit starting\n"));
+
        /* walk the list backwards, to do the first entry first, as we
         * added the entries with DLIST_ADD() which puts them at the
         * start of the list */
@@ -1223,12 +1225,16 @@ static int linked_attributes_prepare_commit(struct ldb_module *module)
                ret = la_do_mod_request(module, ac);
                if (ret != LDB_SUCCESS) {
                        DEBUG(0,(__location__ ": Failed mod request ret=%d\n", ret));
+                       talloc_free(la_private);
+                       ldb_module_set_private(module, NULL);   
                        return ret;
                }
        }
 
        talloc_free(la_private);
        ldb_module_set_private(module, NULL);   
+
+       DEBUG(0,(__location__ ": prepare commit done\n"));
        
        return ldb_next_prepare_commit(module);
 }