summaryrefslogtreecommitdiffstats
path: root/crypto/ecdsa
diff options
context:
space:
mode:
authorRich Salz <rsalz@openssl.org>2015-03-25 18:35:24 -0400
committerRich Salz <rsalz@openssl.org>2015-03-25 18:35:24 -0400
commit8fdc3734c063146b038608c2412a0f2c9b21b6d6 (patch)
treeed30d40a40a6bf7002121a29e3db4b4790a54d87 /crypto/ecdsa
parent17dd65e6e1f888b4561d559b4d44fbbe0a0aa3e7 (diff)
free NULL cleanup.
This gets EC_GROUP_clear_free EC_GROUP_free, EC_KEY_free, EC_POINT_clear_free, EC_POINT_free Reviewed-by: Kurt Roeckx <kurt@openssl.org>
Diffstat (limited to 'crypto/ecdsa')
-rw-r--r--crypto/ecdsa/ecdsatest.c12
-rw-r--r--crypto/ecdsa/ecs_ossl.c6
2 files changed, 6 insertions, 12 deletions
diff --git a/crypto/ecdsa/ecdsatest.c b/crypto/ecdsa/ecdsatest.c
index 346ccd053f..3a455b4747 100644
--- a/crypto/ecdsa/ecdsatest.c
+++ b/crypto/ecdsa/ecdsatest.c
@@ -240,8 +240,7 @@ int x9_62_test_internal(BIO *out, int nid, const char *r_in, const char *s_in)
x962_int_err:
if (!ret)
BIO_printf(out, " failed\n");
- if (key)
- EC_KEY_free(key);
+ EC_KEY_free(key);
if (signature)
ECDSA_SIG_free(signature);
if (r)
@@ -354,9 +353,8 @@ int test_builtin(BIO *out)
goto builtin_err;
EC_GROUP_free(group);
degree = EC_GROUP_get_degree(EC_KEY_get0_group(eckey));
- if (degree < 160)
+ if (degree < 160) {
/* drop the curve */
- {
EC_KEY_free(eckey);
eckey = NULL;
continue;
@@ -506,10 +504,8 @@ int test_builtin(BIO *out)
ret = 1;
builtin_err:
- if (eckey)
- EC_KEY_free(eckey);
- if (wrong_eckey)
- EC_KEY_free(wrong_eckey);
+ EC_KEY_free(eckey);
+ EC_KEY_free(wrong_eckey);
if (ecdsa_sig)
ECDSA_SIG_free(ecdsa_sig);
if (signature)
diff --git a/crypto/ecdsa/ecs_ossl.c b/crypto/ecdsa/ecs_ossl.c
index 1343850e5a..ce2973df20 100644
--- a/crypto/ecdsa/ecs_ossl.c
+++ b/crypto/ecdsa/ecs_ossl.c
@@ -242,8 +242,7 @@ static int ecdsa_sign_setup(EC_KEY *eckey, BN_CTX *ctx_in,
BN_CTX_free(ctx);
if (order != NULL)
BN_free(order);
- if (tmp_point != NULL)
- EC_POINT_free(tmp_point);
+ EC_POINT_free(tmp_point);
if (X)
BN_clear_free(X);
return (ret);
@@ -475,7 +474,6 @@ static int ecdsa_do_verify(const unsigned char *dgst, int dgst_len,
err:
BN_CTX_end(ctx);
BN_CTX_free(ctx);
- if (point)
- EC_POINT_free(point);
+ EC_POINT_free(point);
return ret;
}