diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2014-07-12 16:03:38 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2014-07-12 16:03:38 +0000 |
commit | 803c8dd8383f2beecc51eeb93a0d74de48fde813 (patch) | |
tree | 7f45d2fc5e781e1974149986eb31d41236a274ec /lib/libcrypto/asn1 | |
parent | 5ea82a759638e52c9147469bf1c240afd43f265c (diff) |
if (x) FOO_free(x) -> FOO_free(x).
Improves readability, keeps the code smaller so that it is warmer in your
cache.
review & ok deraadt@
Diffstat (limited to 'lib/libcrypto/asn1')
-rw-r--r-- | lib/libcrypto/asn1/a_object.c | 8 | ||||
-rw-r--r-- | lib/libcrypto/asn1/asn1_par.c | 11 | ||||
-rw-r--r-- | lib/libcrypto/asn1/evp_asn1.c | 8 | ||||
-rw-r--r-- | lib/libcrypto/asn1/x_pkey.c | 8 | ||||
-rw-r--r-- | lib/libcrypto/asn1/x_pubkey.c | 5 |
5 files changed, 15 insertions, 25 deletions
diff --git a/lib/libcrypto/asn1/a_object.c b/lib/libcrypto/asn1/a_object.c index 551aece6ad8..863aa6a226a 100644 --- a/lib/libcrypto/asn1/a_object.c +++ b/lib/libcrypto/asn1/a_object.c @@ -1,4 +1,4 @@ -/* $OpenBSD: a_object.c,v 1.21 2014/07/11 08:44:47 jsing Exp $ */ +/* $OpenBSD: a_object.c,v 1.22 2014/07/12 16:03:36 miod Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -206,15 +206,13 @@ a2d_ASN1_OBJECT(unsigned char *out, int olen, const char *buf, int num) } if (tmp != ftmp) free(tmp); - if (bl) - BN_free(bl); + BN_free(bl); return (len); err: if (tmp != ftmp) free(tmp); - if (bl) - BN_free(bl); + BN_free(bl); return (0); } diff --git a/lib/libcrypto/asn1/asn1_par.c b/lib/libcrypto/asn1/asn1_par.c index c6f95c42aba..f5e3a8b5297 100644 --- a/lib/libcrypto/asn1/asn1_par.c +++ b/lib/libcrypto/asn1/asn1_par.c @@ -1,4 +1,4 @@ -/* $OpenBSD: asn1_par.c,v 1.19 2014/07/11 08:44:47 jsing Exp $ */ +/* $OpenBSD: asn1_par.c,v 1.20 2014/07/12 16:03:36 miod Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -291,10 +291,8 @@ asn1_parse2(BIO *bp, const unsigned char **pp, long length, int offset, nl = 1; } } - if (os != NULL) { - M_ASN1_OCTET_STRING_free(os); - os = NULL; - } + M_ASN1_OCTET_STRING_free(os); + os = NULL; } else if (tag == V_ASN1_INTEGER) { ASN1_INTEGER *bs; int i; @@ -376,8 +374,7 @@ asn1_parse2(BIO *bp, const unsigned char **pp, long length, int offset, end: if (o != NULL) ASN1_OBJECT_free(o); - if (os != NULL) - M_ASN1_OCTET_STRING_free(os); + M_ASN1_OCTET_STRING_free(os); *pp = p; return (ret); } diff --git a/lib/libcrypto/asn1/evp_asn1.c b/lib/libcrypto/asn1/evp_asn1.c index 199c12f9a40..5e21f3c8ae4 100644 --- a/lib/libcrypto/asn1/evp_asn1.c +++ b/lib/libcrypto/asn1/evp_asn1.c @@ -1,4 +1,4 @@ -/* $OpenBSD: evp_asn1.c,v 1.12 2014/07/11 13:41:59 miod Exp $ */ +/* $OpenBSD: evp_asn1.c,v 1.13 2014/07/12 16:03:36 miod Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -193,9 +193,7 @@ err: ASN1err(ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING, ASN1_R_DATA_IS_WRONG); } - if (os != NULL) - M_ASN1_OCTET_STRING_free(os); - if (ai != NULL) - M_ASN1_INTEGER_free(ai); + M_ASN1_OCTET_STRING_free(os); + M_ASN1_INTEGER_free(ai); return (ret); } diff --git a/lib/libcrypto/asn1/x_pkey.c b/lib/libcrypto/asn1/x_pkey.c index a5134bc6a2a..d454afb72bb 100644 --- a/lib/libcrypto/asn1/x_pkey.c +++ b/lib/libcrypto/asn1/x_pkey.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x_pkey.c,v 1.14 2014/07/11 08:44:47 jsing Exp $ */ +/* $OpenBSD: x_pkey.c,v 1.15 2014/07/12 16:03:36 miod Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -149,10 +149,8 @@ X509_PKEY_free(X509_PKEY *x) if (x->enc_algor != NULL) X509_ALGOR_free(x->enc_algor); - if (x->enc_pkey != NULL) - M_ASN1_OCTET_STRING_free(x->enc_pkey); - if (x->dec_pkey != NULL) - EVP_PKEY_free(x->dec_pkey); + M_ASN1_OCTET_STRING_free(x->enc_pkey); + EVP_PKEY_free(x->dec_pkey); if ((x->key_data != NULL) && (x->key_free)) free(x->key_data); free(x); diff --git a/lib/libcrypto/asn1/x_pubkey.c b/lib/libcrypto/asn1/x_pubkey.c index 87cb25bb507..56cc63059a7 100644 --- a/lib/libcrypto/asn1/x_pubkey.c +++ b/lib/libcrypto/asn1/x_pubkey.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x_pubkey.c,v 1.21 2014/07/11 08:44:47 jsing Exp $ */ +/* $OpenBSD: x_pubkey.c,v 1.22 2014/07/12 16:03:36 miod Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -183,8 +183,7 @@ X509_PUBKEY_get(X509_PUBKEY *key) return ret; error: - if (ret != NULL) - EVP_PKEY_free(ret); + EVP_PKEY_free(ret); return (NULL); } |