fix a memory leak in ddb_cons_free
fix a few minor issues in error handling in ddb_cons_finalize