mirror of
https://github.com/openssl/openssl.git
synced 2024-11-21 01:15:20 +08:00
RT3856: Fix memory leaks in test code
Reviewed-by: Matt Caswell <matt@openssl.org>
This commit is contained in:
parent
a1c506ae9e
commit
2d540402aa
@ -1043,7 +1043,6 @@ int test_mod_exp_mont_consttime(BIO *bp, BN_CTX *ctx)
|
||||
int test_mod_exp_mont5(BIO *bp, BN_CTX *ctx)
|
||||
{
|
||||
BIGNUM *a, *p, *m, *d, *e;
|
||||
|
||||
BN_MONT_CTX *mont;
|
||||
|
||||
a = BN_new();
|
||||
@ -1051,7 +1050,6 @@ int test_mod_exp_mont5(BIO *bp, BN_CTX *ctx)
|
||||
m = BN_new();
|
||||
d = BN_new();
|
||||
e = BN_new();
|
||||
|
||||
mont = BN_MONT_CTX_new();
|
||||
|
||||
BN_bntest_rand(m, 1024, 0, 1); /* must be odd for montgomery */
|
||||
@ -1100,6 +1098,7 @@ int test_mod_exp_mont5(BIO *bp, BN_CTX *ctx)
|
||||
fprintf(stderr, "Modular exponentiation test failed!\n");
|
||||
return 0;
|
||||
}
|
||||
BN_MONT_CTX_free(mont);
|
||||
BN_free(a);
|
||||
BN_free(p);
|
||||
BN_free(m);
|
||||
|
@ -188,6 +188,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
printf("test 4 ok\n");
|
||||
test5:
|
||||
HMAC_CTX_cleanup(&ctx);
|
||||
HMAC_CTX_init(&ctx);
|
||||
if (HMAC_Init_ex(&ctx, test[4].key, test[4].key_len, NULL, NULL)) {
|
||||
printf("Should fail to initialise HMAC with empty MD (test 5)\n");
|
||||
@ -277,6 +278,7 @@ test5:
|
||||
printf("test 5 ok\n");
|
||||
}
|
||||
test6:
|
||||
HMAC_CTX_cleanup(&ctx);
|
||||
HMAC_CTX_init(&ctx);
|
||||
if (!HMAC_Init_ex(&ctx, test[7].key, test[7].key_len, EVP_sha1(), NULL)) {
|
||||
printf("Failed to initialise HMAC (test 6)\n");
|
||||
@ -307,6 +309,7 @@ test6:
|
||||
printf("test 6 ok\n");
|
||||
}
|
||||
end:
|
||||
HMAC_CTX_cleanup(&ctx);
|
||||
EXIT(err);
|
||||
}
|
||||
|
||||
|
@ -148,6 +148,7 @@ int main(int argc, char **argv)
|
||||
ERR_remove_thread_state(NULL);
|
||||
ERR_free_strings();
|
||||
CRYPTO_mem_leaks(bio_err);
|
||||
BIO_free(bio_err);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user