diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2011-09-14 08:13:26 +0930 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2011-09-14 08:13:26 +0930 |
commit | 5fac36f5adcc3bd483fa5b4e068db3c1174e8a4a (patch) | |
tree | eb6b2eb5e02d217e2095c30c282d62e4c1cd7c1d /lib/tdb2/test/external-agent.c | |
parent | 1cb92ea9cf3efcc5f4295b7aeb8ddd10e174127c (diff) | |
download | samba-5fac36f5adcc3bd483fa5b4e068db3c1174e8a4a.tar.gz samba-5fac36f5adcc3bd483fa5b4e068db3c1174e8a4a.tar.bz2 samba-5fac36f5adcc3bd483fa5b4e068db3c1174e8a4a.zip |
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 <rusty@rustcorp.com.au>
(Imported from CCAN commit d9cbd7d4454ae35e4e2f6d18a9469bf26948e4b9)
Diffstat (limited to 'lib/tdb2/test/external-agent.c')
-rw-r--r-- | lib/tdb2/test/external-agent.c | 6 |
1 files changed, 4 insertions, 2 deletions
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: |