Commit b6604a90 authored by Bradley C. Kuszmaul's avatar Bradley C. Kuszmaul

test_abort1.tdb runs doesn't leak memory. Addresses #253.

git-svn-id: file:///svn/tokudb@1625 c7de825b-a66e-492c-adef-691d508d4ae1
parent bfc2be07
......@@ -686,5 +686,11 @@ int toku_logger_abort(TOKUTXN txn) {
logtype_dispatch_assign(item, toku_rollback_, r, txn);
if (r!=0) return r;
}
while ((item=txn->newest_logentry)) {
txn->newest_logentry=item->tmp;
logtype_dispatch(item, toku_free_logtype_);
free(item);
}
toku_free(txn);
return 0;
}
......@@ -156,6 +156,15 @@ void generate_dispatch (void) {
}
void generate_log_free(void) {
DO_LOGTYPES(lt, ({
fprintf2(cf, hf, "void toku_free_logtype_%s(struct logtype_%s *e)", lt->name, lt->name);
fprintf(hf, ";\n");
fprintf(cf, " {\n");
DO_FIELDS(ft, lt, fprintf(cf, " toku_free_%s(e->%s);\n", ft->type, ft->name));
fprintf(cf, "}\n");
}));
}
void generate_log_writer (void) {
DO_LOGTYPES(lt, ({
......@@ -330,6 +339,7 @@ int main (int argc __attribute__((__unused__)), char *argv[] __attribute__((__u
generate_log_struct();
generate_dispatch();
generate_log_writer();
generate_log_free();
generate_log_reader();
generate_logprint();
{
......
......@@ -693,7 +693,10 @@ static TXNID next_txn = 0;
static int toku_txn_abort(DB_TXN * txn) {
HANDLE_PANICKED_ENV(txn->mgrp);
return toku_logger_abort(txn->i->tokutxn);
int r = toku_logger_abort(txn->i->tokutxn);
toku_free(txn->i);
toku_free(txn);
return r;
}
static int toku_txn_begin(DB_ENV * env, DB_TXN * stxn, DB_TXN ** txn, u_int32_t flags) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment