Merge pull request #8619 from davidhorstmann-arm/fix-selftest-doublefree

Fix potential double-free in calloc selftest
This commit is contained in:
Paul Elliott 2023-12-08 12:23:13 +00:00 committed by GitHub
commit 0f60c673f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -79,6 +79,7 @@ static int calloc_self_test(int verbose)
if (verbose) {
mbedtls_printf(" CALLOC(0,1): passed (same non-null)\n");
}
empty2 = NULL;
} else {
if (verbose) {
mbedtls_printf(" CALLOC(0,1): passed (distinct non-null)\n");
@ -103,6 +104,7 @@ static int calloc_self_test(int verbose)
if (verbose) {
mbedtls_printf(" CALLOC(1,0): passed (same non-null)\n");
}
empty2 = NULL;
} else {
if (verbose) {
mbedtls_printf(" CALLOC(1,0): passed (distinct non-null)\n");
@ -119,6 +121,7 @@ static int calloc_self_test(int verbose)
mbedtls_printf(" CALLOC(1): failed (same buffer twice)\n");
}
++failures;
buffer2 = NULL;
} else {
if (verbose) {
mbedtls_printf(" CALLOC(1): passed\n");