diff options
author | Rich Salz <rsalz@openssl.org> | 2015-03-25 18:35:24 -0400 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2015-03-25 18:35:24 -0400 |
commit | 8fdc3734c063146b038608c2412a0f2c9b21b6d6 (patch) | |
tree | ed30d40a40a6bf7002121a29e3db4b4790a54d87 /crypto/ec/ec_lib.c | |
parent | 17dd65e6e1f888b4561d559b4d44fbbe0a0aa3e7 (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/ec/ec_lib.c')
-rw-r--r-- | crypto/ec/ec_lib.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/crypto/ec/ec_lib.c b/crypto/ec/ec_lib.c index 2dcdb40168..0e850d699e 100644 --- a/crypto/ec/ec_lib.c +++ b/crypto/ec/ec_lib.c @@ -138,8 +138,7 @@ void EC_GROUP_free(EC_GROUP *group) if (group->mont_data) BN_MONT_CTX_free(group->mont_data); - if (group->generator != NULL) - EC_POINT_free(group->generator); + EC_POINT_free(group->generator); BN_free(group->order); BN_free(group->cofactor); @@ -164,8 +163,7 @@ void EC_GROUP_clear_free(EC_GROUP *group) if (group->mont_data) BN_MONT_CTX_free(group->mont_data); - if (group->generator != NULL) - EC_POINT_clear_free(group->generator); + EC_POINT_clear_free(group->generator); BN_clear_free(group->order); BN_clear_free(group->cofactor); @@ -232,10 +230,8 @@ int EC_GROUP_copy(EC_GROUP *dest, const EC_GROUP *src) return 0; } else { /* src->generator == NULL */ - if (dest->generator != NULL) { - EC_POINT_clear_free(dest->generator); - dest->generator = NULL; - } + EC_POINT_clear_free(dest->generator); + dest->generator = NULL; } if (!BN_copy(dest->order, src->order)) @@ -283,10 +279,9 @@ EC_GROUP *EC_GROUP_dup(const EC_GROUP *a) err: if (!ok) { - if (t) - EC_GROUP_free(t); + EC_GROUP_free(t); return NULL; - } else + } return t; } @@ -790,8 +785,8 @@ EC_POINT *EC_POINT_dup(const EC_POINT *a, const EC_GROUP *group) if (!r) { EC_POINT_free(t); return NULL; - } else - return t; + } + return t; } const EC_METHOD *EC_POINT_method_of(const EC_POINT *point) |