commit 4aa6134c7316c58c8e6755d7efe64cdc7485739c
parent 4a326e9337304a3b4c5692f9085490e0ead03d63
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Mon, 7 Sep 2015 11:08:07 +0200
Fix a memory leak in the test of the AES rng
If the AES NI were not supported, the test stoped without releasing its proxy
allocator.
Diffstat:
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/test_ssp_rng.c b/src/test_ssp_rng.c
@@ -41,8 +41,9 @@ static void /* Really basic test */
test_rng(const struct ssp_rng_type* type)
{
FILE* stream;
- struct ssp_rng* rng;
- struct ssp_rng* rng1, * rng2;
+ struct ssp_rng* rng = NULL;
+ struct ssp_rng* rng1 = NULL;
+ struct ssp_rng* rng2 = NULL;
struct mem_allocator allocator;
struct time t0, t1;
uint64_t datai0[NRAND];
@@ -69,7 +70,7 @@ test_rng(const struct ssp_rng_type* type)
#ifdef WITH_R123_AES
if (r == RES_BAD_OP && type == &ssp_rng_aes) {
printf("AES-NI instructions not available on this CPU and system.\n");
- return;
+ goto exit;
}
#endif
CHECK(r, RES_OK);
@@ -183,6 +184,8 @@ test_rng(const struct ssp_rng_type* type)
CHECK(ssp_rng_ref_put(rng), RES_OK);
ssp_rng_ref_put(rng1);
ssp_rng_ref_put(rng2);
+
+exit:
check_memory_allocator(&allocator);
mem_shutdown_proxy_allocator(&allocator);
}