diff options
author | Nick Mathewson <nickm@torproject.org> | 2013-02-11 15:20:20 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2013-02-11 15:20:20 -0500 |
commit | 52263b0dda85632ea1deb0f05a83a39d4876f3ab (patch) | |
tree | ae54f15700896adda86bce5cb4170b14f7615ecd /src/test/bench.c | |
parent | 96b1bd4fb8e64503c5038a764ece46d950917f07 (diff) | |
download | tor-52263b0dda85632ea1deb0f05a83a39d4876f3ab.tar.gz tor-52263b0dda85632ea1deb0f05a83a39d4876f3ab.zip |
Fix even more dead code and resource leaks in the unit tests
Found by coverity
Diffstat (limited to 'src/test/bench.c')
-rw-r--r-- | src/test/bench.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/test/bench.c b/src/test/bench.c index 18a5154e11..5a8d21d173 100644 --- a/src/test/bench.c +++ b/src/test/bench.c @@ -124,8 +124,10 @@ bench_onion_TAP(void) key = crypto_pk_new(); key2 = crypto_pk_new(); - crypto_pk_generate_key_with_bits(key, 1024); - crypto_pk_generate_key_with_bits(key2, 1024); + if (crypto_pk_generate_key_with_bits(key, 1024) < 0) + goto done; + if (crypto_pk_generate_key_with_bits(key2, 1024) < 0) + goto done; reset_perftime(); start = perftime(); @@ -171,7 +173,9 @@ bench_onion_TAP(void) printf("Client-side, part 2: %f usec.\n", NANOCOUNT(start, end, iters)/1e3); + done: crypto_pk_free(key); + crypto_pk_free(key2); } #ifdef CURVE25519_ENABLED |