various memory leak fixes.
Test iterators, fix dagdb_trie_insert bug.