Skip to content

Commit 9ee212c

Browse files
fix for free'ing memory with test case
1 parent cdd02f9 commit 9ee212c

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

tests/api.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33211,7 +33211,7 @@ static int test_wolfSSL_RAND_bytes(void)
3321133211

3321233212
max_bufsize = size4;
3321333213

33214-
ExpectNotNull(my_buf = (byte*)XMALLOC(max_bufsize * sizeof(byte), NULL,
33214+
ExpectNotNull(my_buf = (byte*)XMALLOC(max_bufsize * sizeof(byte), HEAP_HINT,
3321533215
DYNAMIC_TYPE_TMP_BUFFER));
3321633216

3321733217
ExpectIntEQ(RAND_bytes(my_buf, 0), 1);
@@ -33222,6 +33222,7 @@ static int test_wolfSSL_RAND_bytes(void)
3322233222
ExpectIntEQ(RAND_bytes(my_buf, size2), 1);
3322333223
ExpectIntEQ(RAND_bytes(my_buf, size3), 1);
3322433224
ExpectIntEQ(RAND_bytes(my_buf, size4), 1);
33225+
XFREE(my_buf, HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER);
3322533226

3322633227
#if defined(OPENSSL_EXTRA) && defined(HAVE_GETPID)
3322733228
XMEMSET(seed, 0, sizeof(seed));
@@ -33262,8 +33263,6 @@ static int test_wolfSSL_RAND_bytes(void)
3326233263
}
3326333264
RAND_cleanup();
3326433265
#endif
33265-
33266-
XFREE(my_buf, NULL, DYNAMIC_TYPE_TMP_BUFFER);
3326733266
#endif
3326833267
return EXPECT_RESULT();
3326933268
}

0 commit comments

Comments
 (0)