Commit 9398221d authored by Bradley C. Kuszmaul's avatar Bradley C. Kuszmaul

The problem was in the test code. It was creating a MALLOC DBT and then never...

The problem was in the test code.  It was creating a MALLOC DBT and then never freeing stuff. Fixes #1026.

git-svn-id: file:///svn/tokudb@5189 c7de825b-a66e-492c-adef-691d508d4ae1
parent d3de9007
...@@ -54,12 +54,14 @@ void run (int choice) { ...@@ -54,12 +54,14 @@ void run (int choice) {
DBC *c; DBC *c;
r=db->cursor(db, txn, &c, 0); CKERR(r); r=db->cursor(db, txn, &c, 0); CKERR(r);
DBT kdbt,vdbt; DBT kdbt,vdbt;
dbt_init_malloc(&kdbt); memset(&kdbt, 0, sizeof(kdbt));
dbt_init_malloc(&vdbt); memset(&vdbt, 0, sizeof(vdbt));
i=0; i=0;
while (0==(r=c->c_get(c, &kdbt, &vdbt, DB_NEXT))) { while (0==(r=c->c_get(c, &kdbt, &vdbt, DB_NEXT))) {
//printf("Got %d %d\n", *(unsigned char*)kdbt.data, *(unsigned char*)vdbt.data); //printf("Got %d %d\n", *(unsigned char*)kdbt.data, *(unsigned char*)vdbt.data);
i++; i++;
kdbt.data=0;
vdbt.data=0;
} }
CKERR2(r, DB_NOTFOUND); CKERR2(r, DB_NOTFOUND);
//printf("i=%d N=%d\n", i, N); //printf("i=%d N=%d\n", i, N);
...@@ -72,8 +74,8 @@ void run (int choice) { ...@@ -72,8 +74,8 @@ void run (int choice) {
DBC *c; DBC *c;
r=db->cursor(db, txn, &c, 0); CKERR(r); r=db->cursor(db, txn, &c, 0); CKERR(r);
DBT kdbt,vdbt; DBT kdbt,vdbt;
dbt_init_malloc(&kdbt); memset(&kdbt, 0, sizeof(kdbt));
dbt_init_malloc(&vdbt); memset(&vdbt, 0, sizeof(vdbt));
i=0; i=0;
while (0==(r=(c->c_get(c, &kdbt, &vdbt, DB_FIRST)))) { while (0==(r=(c->c_get(c, &kdbt, &vdbt, DB_FIRST)))) {
i++; i++;
......
...@@ -50,11 +50,11 @@ void run (void) { ...@@ -50,11 +50,11 @@ void run (void) {
assert(*(char*)k.data==vN); assert(ntohl(*(int*)v.data)==i); assert(*(char*)k.data==vN); assert(ntohl(*(int*)v.data)==i);
} }
r=c->c_get(c, dbt_init_malloc(&k), dbt_init_malloc(&v), DB_NEXT); CKERR(r); r=c->c_get(c, dbt_init(&k, 0, 0), dbt_init(&v, 0, 0), DB_NEXT); CKERR(r);
assert(*(char*)k.data==v1); assert(*(char*)v.data==v101); assert(*(char*)k.data==v1); assert(*(char*)v.data==v101);
r=c->c_get(c, dbt_init_malloc(&k), dbt_init_malloc(&v), DB_NEXT); CKERR(r); r=c->c_get(c, dbt_init(&k, 0, 0), dbt_init(&v, 0, 0), DB_NEXT); CKERR(r);
assert(*(char*)k.data==v2); assert(*(char*)v.data==v102); assert(*(char*)k.data==v2); assert(*(char*)v.data==v102);
r=c->c_get(c, dbt_init_malloc(&k), dbt_init_malloc(&v), DB_NEXT); assert(r!=0); r=c->c_get(c, dbt_init(&k, 0, 0), dbt_init(&v, 0, 0), DB_NEXT); assert(r!=0);
r=c->c_close(c); CKERR(r); r=c->c_close(c); CKERR(r);
r=txn->commit(txn, 0); CKERR(r); r=txn->commit(txn, 0); CKERR(r);
} }
......
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