From 5fac36f5adcc3bd483fa5b4e068db3c1174e8a4a Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 14 Sep 2011 08:13:26 +0930 Subject: tdb2: test: fix run-57-die-during-transaction.c to be more efficient. We track malloc and free, but we didn't catch the free() inside external_agent, which means that our list of allocations keeps growing. Particularly under valgrind, which re-uses memory less than the glibc allocator. Signed-off-by: Rusty Russell (Imported from CCAN commit d9cbd7d4454ae35e4e2f6d18a9469bf26948e4b9) --- lib/tdb2/test/external-agent.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib/tdb2/test/external-agent.c') diff --git a/lib/tdb2/test/external-agent.c b/lib/tdb2/test/external-agent.c index 23874777da..01c7106fba 100644 --- a/lib/tdb2/test/external-agent.c +++ b/lib/tdb2/test/external-agent.c @@ -17,6 +17,8 @@ static struct tdb_context *tdb; +void (*external_agent_free)(void *) = free; + static enum TDB_ERROR clear_if_first(int fd, void *arg) { /* We hold a lock offset 4 always, so we can tell if anyone is holding it. @@ -100,10 +102,10 @@ static enum agent_return do_operation(enum operation op, const char *name) ret = OTHER_FAILURE; } else if (!tdb_deq(data, k)) { ret = OTHER_FAILURE; - free(data.dptr); + external_agent_free(data.dptr); } else { ret = SUCCESS; - free(data.dptr); + external_agent_free(data.dptr); } break; case STORE: -- cgit