Skip to content

Commit d9beec2

Browse files
Merge pull request #10283 from night1rider/SHE-test-double-free-fix
Fix double-free of she2 in she_test()
2 parents 90366b7 + d673b62 commit d9beec2

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

wolfcrypt/test/test.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57861,6 +57861,9 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t she_test(void)
5786157861
ret = wc_SHE_Init(she2, HEAP_HINT, devId);
5786257862
if (ret != 0) {
5786357863
WC_FREE_VAR(she2, HEAP_HINT);
57864+
#ifdef WC_DECLARE_VAR_IS_HEAP_ALLOC
57865+
she2 = NULL;
57866+
#endif
5786457867
goto exit_SHE_Test;
5786557868
}
5786657869

@@ -57874,6 +57877,9 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t she_test(void)
5787457877
if (ret != 0) {
5787557878
wc_SHE_Free(she2);
5787657879
WC_FREE_VAR(she2, HEAP_HINT);
57880+
#ifdef WC_DECLARE_VAR_IS_HEAP_ALLOC
57881+
she2 = NULL;
57882+
#endif
5787757883
goto exit_SHE_Test;
5787857884
}
5787957885

@@ -57887,6 +57893,9 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t she_test(void)
5788757893

5788857894
wc_SHE_Free(she2);
5788957895
WC_FREE_VAR(she2, HEAP_HINT);
57896+
#ifdef WC_DECLARE_VAR_IS_HEAP_ALLOC
57897+
she2 = NULL;
57898+
#endif
5789057899

5789157900
if (ret != 0) {
5789257901
goto exit_SHE_Test;

0 commit comments

Comments
 (0)