summaryrefslogtreecommitdiff
path: root/lib/libcrypto/ec
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2014-05-30 06:22:58 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2014-05-30 06:22:58 +0000
commit92fe7f51d198ea62cc552bf356ca8d58fa48417f (patch)
treeb9cbba44945fc3ef0c4bbbd4778edfff3328f155 /lib/libcrypto/ec
parent5e5527b3e65377286505a3ba5f9a7f0fa64f00f1 (diff)
more: no need for null check before free
ok tedu guenther
Diffstat (limited to 'lib/libcrypto/ec')
-rw-r--r--lib/libcrypto/ec/ec_ameth.c3
-rw-r--r--lib/libcrypto/ec/ec_asn1.c3
-rw-r--r--lib/libcrypto/ec/ec_mult.c11
-rw-r--r--lib/libcrypto/ec/eck_prn.c3
-rw-r--r--lib/libcrypto/ec/ecp_nistp224.c9
-rw-r--r--lib/libcrypto/ec/ecp_nistp256.c9
-rw-r--r--lib/libcrypto/ec/ecp_nistp521.c9
7 files changed, 15 insertions, 32 deletions
diff --git a/lib/libcrypto/ec/ec_ameth.c b/lib/libcrypto/ec/ec_ameth.c
index b41879c4315..ec074329f27 100644
--- a/lib/libcrypto/ec/ec_ameth.c
+++ b/lib/libcrypto/ec/ec_ameth.c
@@ -492,8 +492,7 @@ err:
BN_free(order);
if (ctx)
BN_CTX_free(ctx);
- if (buffer != NULL)
- free(buffer);
+ free(buffer);
return (ret);
}
diff --git a/lib/libcrypto/ec/ec_asn1.c b/lib/libcrypto/ec/ec_asn1.c
index 2409cd0886c..342db2a992a 100644
--- a/lib/libcrypto/ec/ec_asn1.c
+++ b/lib/libcrypto/ec/ec_asn1.c
@@ -805,8 +805,7 @@ ec_asn1_parameters2group(const ECPARAMETERS * params)
}
/* extract seed (optional) */
if (params->curve->seed != NULL) {
- if (ret->seed != NULL)
- free(ret->seed);
+ free(ret->seed);
if (!(ret->seed = malloc(params->curve->seed->length))) {
ECerr(EC_F_EC_ASN1_PARAMETERS2GROUP,
ERR_R_MALLOC_FAILURE);
diff --git a/lib/libcrypto/ec/ec_mult.c b/lib/libcrypto/ec/ec_mult.c
index 0fd0cab2f1a..8894a8f907e 100644
--- a/lib/libcrypto/ec/ec_mult.c
+++ b/lib/libcrypto/ec/ec_mult.c
@@ -683,10 +683,8 @@ err:
BN_CTX_free(new_ctx);
if (tmp != NULL)
EC_POINT_free(tmp);
- if (wsize != NULL)
- free(wsize);
- if (wNAF_len != NULL)
- free(wNAF_len);
+ free(wsize);
+ free(wNAF_len);
if (wNAF != NULL) {
signed char **w;
@@ -698,12 +696,9 @@ err:
if (val != NULL) {
for (v = val; *v != NULL; v++)
EC_POINT_clear_free(*v);
-
free(val);
}
- if (val_sub != NULL) {
- free(val_sub);
- }
+ free(val_sub);
return ret;
}
diff --git a/lib/libcrypto/ec/eck_prn.c b/lib/libcrypto/ec/eck_prn.c
index 3f2973e5b65..60b00fddb3a 100644
--- a/lib/libcrypto/ec/eck_prn.c
+++ b/lib/libcrypto/ec/eck_prn.c
@@ -325,8 +325,7 @@ err:
BN_free(cofactor);
if (ctx)
BN_CTX_free(ctx);
- if (buffer != NULL)
- free(buffer);
+ free(buffer);
return (ret);
}
diff --git a/lib/libcrypto/ec/ecp_nistp224.c b/lib/libcrypto/ec/ecp_nistp224.c
index 6e9b9fac3ca..afe25853e6b 100644
--- a/lib/libcrypto/ec/ecp_nistp224.c
+++ b/lib/libcrypto/ec/ecp_nistp224.c
@@ -1546,12 +1546,9 @@ err:
EC_POINT_free(generator);
if (new_ctx != NULL)
BN_CTX_free(new_ctx);
- if (secrets != NULL)
- free(secrets);
- if (pre_comp != NULL)
- free(pre_comp);
- if (tmp_felems != NULL)
- free(tmp_felems);
+ free(secrets);
+ free(pre_comp);
+ free(tmp_felems);
return ret;
}
diff --git a/lib/libcrypto/ec/ecp_nistp256.c b/lib/libcrypto/ec/ecp_nistp256.c
index b2398e106c0..7fe7be27de4 100644
--- a/lib/libcrypto/ec/ecp_nistp256.c
+++ b/lib/libcrypto/ec/ecp_nistp256.c
@@ -2101,12 +2101,9 @@ err:
EC_POINT_free(generator);
if (new_ctx != NULL)
BN_CTX_free(new_ctx);
- if (secrets != NULL)
- free(secrets);
- if (pre_comp != NULL)
- free(pre_comp);
- if (tmp_smallfelems != NULL)
- free(tmp_smallfelems);
+ free(secrets);
+ free(pre_comp);
+ free(tmp_smallfelems);
return ret;
}
diff --git a/lib/libcrypto/ec/ecp_nistp521.c b/lib/libcrypto/ec/ecp_nistp521.c
index 083e017cdc2..5d5a747ee85 100644
--- a/lib/libcrypto/ec/ecp_nistp521.c
+++ b/lib/libcrypto/ec/ecp_nistp521.c
@@ -1988,12 +1988,9 @@ err:
EC_POINT_free(generator);
if (new_ctx != NULL)
BN_CTX_free(new_ctx);
- if (secrets != NULL)
- free(secrets);
- if (pre_comp != NULL)
- free(pre_comp);
- if (tmp_felems != NULL)
- free(tmp_felems);
+ free(secrets);
+ free(pre_comp);
+ free(tmp_felems);
return ret;
}