]> git.codecow.com Git - Monocypher.git/commitdiff
fixed memory leak in Argon2i tests
authorLoup Vaillant <loup@loup-vaillant.fr>
Fri, 20 Apr 2018 22:53:59 +0000 (00:53 +0200)
committerLoup Vaillant <loup@loup-vaillant.fr>
Fri, 20 Apr 2018 22:53:59 +0000 (00:53 +0200)
tests/test.c

index b0073eb076341a2e903f32f2517dc85becaf4c66..01c1fc91eaf32cc6777f5af2f9542642c68a3311 100644 (file)
@@ -527,7 +527,7 @@ static int p_argon2i_easy()
     FOR (i, 0, 128) {
         RANDOM_INPUT(password , 32);
         RANDOM_INPUT(salt     , 16);
-        u8 *work_area = (u8*)alloc(1024 * 8);
+        RANDOM_INPUT(work_area, 1024 * 8);
         u8 hash_general[32];
         u8 hash_easy   [32];
         crypto_argon2i_general(hash_general, 32, work_area, 8, 1,
@@ -543,7 +543,7 @@ static int p_argon2i_overlap()
 {
     int status = 0;
     FOR (i, 0, 128) {
-        u8 *work_area = (u8*)alloc(1024 * 8);  p_random(work_area, 1024 * 8);
+        RANDOM_INPUT(work_area, 1024 * 8);
         u32 pass_offset = rand64() % 128;
         u32 salt_offset = rand64() % 128;
         u32 key_offset  = rand64() % 128;