summaryrefslogtreecommitdiffstats
path: root/crypto/ecdh
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/ecdh
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/ecdh')
-rw-r--r--crypto/ecdh/ecdhtest.c18
-rw-r--r--crypto/ecdh/ech_ossl.c3
2 files changed, 7 insertions, 14 deletions
diff --git a/crypto/ecdh/ecdhtest.c b/crypto/ecdh/ecdhtest.c
index 578de316be..a89177e435 100644
--- a/crypto/ecdh/ecdhtest.c
+++ b/crypto/ecdh/ecdhtest.c
@@ -290,10 +290,8 @@ static int test_ecdh_curve(int nid, const char *text, BN_CTX *ctx, BIO *out)
BN_free(x_b);
if (y_b)
BN_free(y_b);
- if (b)
- EC_KEY_free(b);
- if (a)
- EC_KEY_free(a);
+ EC_KEY_free(b);
+ EC_KEY_free(a);
return (ret);
}
@@ -394,12 +392,10 @@ static EC_KEY *mk_eckey(int nid, const unsigned char *p, size_t plen)
err:
if (priv)
BN_clear_free(priv);
- if (pub)
- EC_POINT_free(pub);
+ EC_POINT_free(pub);
if (ok)
return k;
- else if (k)
- EC_KEY_free(k);
+ EC_KEY_free(k);
return NULL;
}
@@ -440,10 +436,8 @@ static int ecdh_kat(BIO *out, const char *cname, int nid,
goto err;
rv = 1;
err:
- if (key1)
- EC_KEY_free(key1);
- if (key2)
- EC_KEY_free(key2);
+ EC_KEY_free(key1);
+ EC_KEY_free(key2);
if (Ztmp)
OPENSSL_free(Ztmp);
if (rv)
diff --git a/crypto/ecdh/ech_ossl.c b/crypto/ecdh/ech_ossl.c
index 278c41b84a..b8ccf5a719 100644
--- a/crypto/ecdh/ech_ossl.c
+++ b/crypto/ecdh/ech_ossl.c
@@ -202,8 +202,7 @@ static int ecdh_compute_key(void *out, size_t outlen, const EC_POINT *pub_key,
}
err:
- if (tmp)
- EC_POINT_free(tmp);
+ EC_POINT_free(tmp);
if (ctx)
BN_CTX_end(ctx);
if (ctx)