diff options
author | bcook <> | 2017-08-12 17:01:13 +0000 |
---|---|---|
committer | bcook <> | 2017-08-12 17:01:13 +0000 |
commit | dc87624e7186f64ce4a98e042065643de30aa928 (patch) | |
tree | 265cf9d8903cbb3b38c7a6c8dad510ef8de60ede | |
parent | 8ef887a4dbce66cf975e69b9ab3f8f214be85cac (diff) | |
download | openbsd-dc87624e7186f64ce4a98e042065643de30aa928.tar.gz openbsd-dc87624e7186f64ce4a98e042065643de30aa928.tar.bz2 openbsd-dc87624e7186f64ce4a98e042065643de30aa928.zip |
fix resource leaks, ok @guenther
-rw-r--r-- | src/regress/lib/libcrypto/bn/general/bntest.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/regress/lib/libcrypto/bn/general/bntest.c b/src/regress/lib/libcrypto/bn/general/bntest.c index 5faa653022..3cca951cae 100644 --- a/src/regress/lib/libcrypto/bn/general/bntest.c +++ b/src/regress/lib/libcrypto/bn/general/bntest.c | |||
@@ -1063,15 +1063,18 @@ test_mod_exp(BIO *bp, BN_CTX *ctx) | |||
1063 | CHECK_GOTO(BN_zero(c)); | 1063 | CHECK_GOTO(BN_zero(c)); |
1064 | if (BN_mod_exp(d, a, b, c, ctx)) { | 1064 | if (BN_mod_exp(d, a, b, c, ctx)) { |
1065 | fprintf(stderr, "BN_mod_exp with zero modulus succeeded!\n"); | 1065 | fprintf(stderr, "BN_mod_exp with zero modulus succeeded!\n"); |
1066 | return (0); | 1066 | rc = 0; |
1067 | goto err; | ||
1067 | } | 1068 | } |
1068 | if (BN_mod_exp_ct(d, a, b, c, ctx)) { | 1069 | if (BN_mod_exp_ct(d, a, b, c, ctx)) { |
1069 | fprintf(stderr, "BN_mod_exp_ct with zero modulus succeeded!\n"); | 1070 | fprintf(stderr, "BN_mod_exp_ct with zero modulus succeeded!\n"); |
1070 | return (0); | 1071 | rc = 0; |
1072 | goto err; | ||
1071 | } | 1073 | } |
1072 | if (BN_mod_exp_nonct(d, a, b, c, ctx)) { | 1074 | if (BN_mod_exp_nonct(d, a, b, c, ctx)) { |
1073 | fprintf(stderr, "BN_mod_exp_nonct with zero modulus succeeded!\n"); | 1075 | fprintf(stderr, "BN_mod_exp_nonct with zero modulus succeeded!\n"); |
1074 | return (0); | 1076 | rc = 0; |
1077 | goto err; | ||
1075 | } | 1078 | } |
1076 | 1079 | ||
1077 | CHECK_GOTO(BN_bntest_rand(c, 30, 0, 1)); /* must be odd for montgomery */ | 1080 | CHECK_GOTO(BN_bntest_rand(c, 30, 0, 1)); /* must be odd for montgomery */ |
@@ -1420,6 +1423,7 @@ err: | |||
1420 | BN_free(b); | 1423 | BN_free(b); |
1421 | BN_free(n); | 1424 | BN_free(n); |
1422 | BN_free(c); | 1425 | BN_free(c); |
1426 | BN_MONT_CTX_free(mont); | ||
1423 | return (rc); | 1427 | return (rc); |
1424 | } | 1428 | } |
1425 | 1429 | ||