diff options
author | Doug Hogan <doug@cvs.openbsd.org> | 2014-07-25 06:05:33 +0000 |
---|---|---|
committer | Doug Hogan <doug@cvs.openbsd.org> | 2014-07-25 06:05:33 +0000 |
commit | 3f6f56f88d0b43e70952f28437c1872f732542c3 (patch) | |
tree | ecc44b6abb46886be9db095c6e874c37007c483e | |
parent | 325e66f18b509fc53d281184b1c8e88f97b84468 (diff) |
BIO_free() returns immediately when the sole input is NULL.
Remove unnecessary NULL check.
ok miod@
-rw-r--r-- | lib/libcrypto/asn1/bio_ndef.c | 5 | ||||
-rw-r--r-- | lib/libcrypto/bio/bio_lib.c | 5 | ||||
-rw-r--r-- | lib/libcrypto/bio/bss_acpt.c | 8 | ||||
-rw-r--r-- | lib/libcrypto/cms/cms_lib.c | 5 | ||||
-rw-r--r-- | lib/libcrypto/ocsp/ocsp_ht.c | 5 | ||||
-rw-r--r-- | lib/libcrypto/pkcs7/pk7_doit.c | 5 | ||||
-rw-r--r-- | lib/libcrypto/x509/by_file.c | 8 |
7 files changed, 16 insertions, 25 deletions
diff --git a/lib/libcrypto/asn1/bio_ndef.c b/lib/libcrypto/asn1/bio_ndef.c index fd6b0e5f178..1a23c27d041 100644 --- a/lib/libcrypto/asn1/bio_ndef.c +++ b/lib/libcrypto/asn1/bio_ndef.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bio_ndef.c,v 1.8 2014/06/12 15:49:27 deraadt Exp $ */ +/* $OpenBSD: bio_ndef.c,v 1.9 2014/07/25 06:05:32 doug Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project. */ @@ -144,8 +144,7 @@ BIO_new_NDEF(BIO *out, ASN1_VALUE *val, const ASN1_ITEM *it) return sarg.ndef_bio; err: - if (asn_bio) - BIO_free(asn_bio); + BIO_free(asn_bio); free(ndef_aux); return NULL; } diff --git a/lib/libcrypto/bio/bio_lib.c b/lib/libcrypto/bio/bio_lib.c index a2b34a2f80f..477208ed1f1 100644 --- a/lib/libcrypto/bio/bio_lib.c +++ b/lib/libcrypto/bio/bio_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bio_lib.c,v 1.20 2014/07/11 15:40:32 miod Exp $ */ +/* $OpenBSD: bio_lib.c,v 1.21 2014/07/25 06:05:32 doug Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -575,8 +575,7 @@ BIO_dup_chain(BIO *in) } return (ret); err: - if (ret != NULL) - BIO_free(ret); + BIO_free(ret); return (NULL); } diff --git a/lib/libcrypto/bio/bss_acpt.c b/lib/libcrypto/bio/bss_acpt.c index 65d4bb25478..b6131c4d41a 100644 --- a/lib/libcrypto/bio/bss_acpt.c +++ b/lib/libcrypto/bio/bss_acpt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bss_acpt.c,v 1.24 2014/07/13 16:03:09 beck Exp $ */ +/* $OpenBSD: bss_acpt.c,v 1.25 2014/07/25 06:05:32 doug Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -153,8 +153,7 @@ BIO_ACCEPT_free(BIO_ACCEPT *a) free(a->param_addr); free(a->addr); - if (a->bio_chain != NULL) - BIO_free(a->bio_chain); + BIO_free(a->bio_chain); free(a); } @@ -358,8 +357,7 @@ acpt_ctrl(BIO *b, int cmd, long num, void *ptr) } else if (num == 1) { data->accept_nbio = (ptr != NULL); } else if (num == 2) { - if (data->bio_chain != NULL) - BIO_free(data->bio_chain); + BIO_free(data->bio_chain); data->bio_chain = (BIO *)ptr; } } diff --git a/lib/libcrypto/cms/cms_lib.c b/lib/libcrypto/cms/cms_lib.c index ee1f06c89ab..4ca38e24288 100644 --- a/lib/libcrypto/cms/cms_lib.c +++ b/lib/libcrypto/cms/cms_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cms_lib.c,v 1.3 2014/06/12 15:49:28 deraadt Exp $ */ +/* $OpenBSD: cms_lib.c,v 1.4 2014/07/25 06:05:32 doug Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project. */ @@ -360,8 +360,7 @@ cms_DigestAlgorithm_init_bio(X509_ALGOR *digestAlgorithm) return mdbio; err: - if (mdbio) - BIO_free(mdbio); + BIO_free(mdbio); return NULL; } diff --git a/lib/libcrypto/ocsp/ocsp_ht.c b/lib/libcrypto/ocsp/ocsp_ht.c index c895e9df4db..5d1627192cc 100644 --- a/lib/libcrypto/ocsp/ocsp_ht.c +++ b/lib/libcrypto/ocsp/ocsp_ht.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ocsp_ht.c,v 1.20 2014/07/12 14:58:32 miod Exp $ */ +/* $OpenBSD: ocsp_ht.c,v 1.21 2014/07/25 06:05:32 doug Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2006. */ @@ -111,8 +111,7 @@ OCSP_REQ_CTX_free(OCSP_REQ_CTX *rctx) if (rctx == NULL) return; - if (rctx->mem) - BIO_free(rctx->mem); + BIO_free(rctx->mem); free(rctx->iobuf); free(rctx); } diff --git a/lib/libcrypto/pkcs7/pk7_doit.c b/lib/libcrypto/pkcs7/pk7_doit.c index cc6fd97b9de..8f1e3936356 100644 --- a/lib/libcrypto/pkcs7/pk7_doit.c +++ b/lib/libcrypto/pkcs7/pk7_doit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pk7_doit.c,v 1.28 2014/07/12 16:03:37 miod Exp $ */ +/* $OpenBSD: pk7_doit.c,v 1.29 2014/07/25 06:05:32 doug Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -133,8 +133,7 @@ PKCS7_bio_add_digest(BIO **pbio, X509_ALGOR *alg) return 1; err: - if (btmp) - BIO_free(btmp); + BIO_free(btmp); return 0; } diff --git a/lib/libcrypto/x509/by_file.c b/lib/libcrypto/x509/by_file.c index 10adcfbd772..04366460bb0 100644 --- a/lib/libcrypto/x509/by_file.c +++ b/lib/libcrypto/x509/by_file.c @@ -1,4 +1,4 @@ -/* $OpenBSD: by_file.c,v 1.15 2014/07/11 08:44:49 jsing Exp $ */ +/* $OpenBSD: by_file.c,v 1.16 2014/07/25 06:05:32 doug Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -182,8 +182,7 @@ X509_load_cert_file(X509_LOOKUP *ctx, const char *file, int type) err: if (x != NULL) X509_free(x); - if (in != NULL) - BIO_free(in); + BIO_free(in); return (ret); } @@ -243,8 +242,7 @@ X509_load_crl_file(X509_LOOKUP *ctx, const char *file, int type) err: if (x != NULL) X509_CRL_free(x); - if (in != NULL) - BIO_free(in); + BIO_free(in); return (ret); } |