summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/bntest.c33
-rw-r--r--test/dhtest.c3
-rw-r--r--test/dsatest.c3
-rw-r--r--test/ecdhtest.c18
-rw-r--r--test/ecdsatest.c12
-rw-r--r--test/ectest.c6
-rw-r--r--test/ssltest.c6
7 files changed, 27 insertions, 54 deletions
diff --git a/test/bntest.c b/test/bntest.c
index 521858ae16..7aaefc58e5 100644
--- a/test/bntest.c
+++ b/test/bntest.c
@@ -761,14 +761,10 @@ int test_sqr(BIO *bp, BN_CTX *ctx)
}
ret = 1;
err:
- if (a != NULL)
- BN_free(a);
- if (c != NULL)
- BN_free(c);
- if (d != NULL)
- BN_free(d);
- if (e != NULL)
- BN_free(e);
+ BN_free(a);
+ BN_free(c);
+ BN_free(d);
+ BN_free(e);
return ret;
}
@@ -1669,14 +1665,10 @@ int test_kron(BIO *bp, BN_CTX *ctx)
fflush(stderr);
ret = 1;
err:
- if (a != NULL)
- BN_free(a);
- if (b != NULL)
- BN_free(b);
- if (r != NULL)
- BN_free(r);
- if (t != NULL)
- BN_free(t);
+ BN_free(a);
+ BN_free(b);
+ BN_free(r);
+ BN_free(t);
return ret;
}
@@ -1764,12 +1756,9 @@ int test_sqrt(BIO *bp, BN_CTX *ctx)
}
ret = 1;
err:
- if (a != NULL)
- BN_free(a);
- if (p != NULL)
- BN_free(p);
- if (r != NULL)
- BN_free(r);
+ BN_free(a);
+ BN_free(p);
+ BN_free(r);
return ret;
}
diff --git a/test/dhtest.c b/test/dhtest.c
index 35bd298a87..8f71723b31 100644
--- a/test/dhtest.c
+++ b/test/dhtest.c
@@ -201,8 +201,7 @@ int main(int argc, char *argv[])
OPENSSL_free(bbuf);
DH_free(b);
DH_free(a);
- if (_cb)
- BN_GENCB_free(_cb);
+ BN_GENCB_free(_cb);
BIO_free(out);
# ifdef OPENSSL_SYS_NETWARE
if (ret)
diff --git a/test/dsatest.c b/test/dsatest.c
index a5d40f1eb6..e138c64147 100644
--- a/test/dsatest.c
+++ b/test/dsatest.c
@@ -212,8 +212,7 @@ int main(int argc, char **argv)
if (!ret)
ERR_print_errors(bio_err);
DSA_free(dsa);
- if (cb != NULL)
- BN_GENCB_free(cb);
+ BN_GENCB_free(cb);
CRYPTO_cleanup_all_ex_data();
ERR_remove_thread_state(NULL);
ERR_free_strings();
diff --git a/test/ecdhtest.c b/test/ecdhtest.c
index 5c451e52be..af124764c8 100644
--- a/test/ecdhtest.c
+++ b/test/ecdhtest.c
@@ -282,14 +282,10 @@ static int test_ecdh_curve(int nid, const char *text, BN_CTX *ctx, BIO *out)
OPENSSL_free(abuf);
if (bbuf != NULL)
OPENSSL_free(bbuf);
- if (x_a)
- BN_free(x_a);
- if (y_a)
- BN_free(y_a);
- if (x_b)
- BN_free(x_b);
- if (y_b)
- BN_free(y_b);
+ BN_free(x_a);
+ BN_free(y_a);
+ BN_free(x_b);
+ BN_free(y_b);
EC_KEY_free(b);
EC_KEY_free(a);
return (ret);
@@ -390,8 +386,7 @@ static EC_KEY *mk_eckey(int nid, const unsigned char *p, size_t plen)
goto err;
ok = 1;
err:
- if (priv)
- BN_clear_free(priv);
+ BN_clear_free(priv);
EC_POINT_free(pub);
if (ok)
return k;
@@ -526,8 +521,7 @@ int main(int argc, char *argv[])
err:
ERR_print_errors_fp(stderr);
- if (ctx)
- BN_CTX_free(ctx);
+ BN_CTX_free(ctx);
BIO_free(out);
CRYPTO_cleanup_all_ex_data();
ERR_remove_thread_state(NULL);
diff --git a/test/ecdsatest.c b/test/ecdsatest.c
index 3a455b4747..1eeaabaa04 100644
--- a/test/ecdsatest.c
+++ b/test/ecdsatest.c
@@ -243,15 +243,11 @@ int x9_62_test_internal(BIO *out, int nid, const char *r_in, const char *s_in)
EC_KEY_free(key);
if (signature)
ECDSA_SIG_free(signature);
- if (r)
- BN_free(r);
- if (s)
- BN_free(s);
+ BN_free(r);
+ BN_free(s);
EVP_MD_CTX_cleanup(&md_ctx);
- if (kinv)
- BN_clear_free(kinv);
- if (rp)
- BN_clear_free(rp);
+ BN_clear_free(kinv);
+ BN_clear_free(rp);
return ret;
}
diff --git a/test/ectest.c b/test/ectest.c
index 79ec21f820..7320d3dfe4 100644
--- a/test/ectest.c
+++ b/test/ectest.c
@@ -851,8 +851,7 @@ static void prime_field_tests(void)
BN_free(scalar3);
}
- if (ctx)
- BN_CTX_free(ctx);
+ BN_CTX_free(ctx);
BN_free(p);
BN_free(a);
BN_free(b);
@@ -1326,8 +1325,7 @@ static void char2_field_tests(void)
fprintf(stdout, " ok\n\n");
}
- if (ctx)
- BN_CTX_free(ctx);
+ BN_CTX_free(ctx);
BN_free(p);
BN_free(a);
BN_free(b);
diff --git a/test/ssltest.c b/test/ssltest.c
index a716c3c05f..311fbc9d61 100644
--- a/test/ssltest.c
+++ b/test/ssltest.c
@@ -2939,8 +2939,7 @@ static RSA *tmp_rsa_cb(SSL *s, int is_export, int keylength)
end:
printf("\n");
}
- if (bn)
- BN_free(bn);
+ BN_free(bn);
return (rsa_tmp);
}
@@ -3106,8 +3105,7 @@ static int psk_key2bn(const char *pskkey, unsigned char *psk,
if (!ret) {
BIO_printf(bio_err, "Could not convert PSK key '%s' to BIGNUM\n",
pskkey);
- if (bn)
- BN_free(bn);
+ BN_free(bn);
return 0;
}
if (BN_num_bytes(bn) > (int)max_psk_len) {