diff options
| author | doug <> | 2014-07-25 06:05:32 +0000 |
|---|---|---|
| committer | doug <> | 2014-07-25 06:05:32 +0000 |
| commit | d9473bfc95b9bc3edd71f25c11f0b47b27500df9 (patch) | |
| tree | 557034a0625ab745a7737c138d34237c330c8398 /src/lib/libcrypto | |
| parent | 5725285badaf27118ed38bdce958a0f6a0ce9962 (diff) | |
| download | openbsd-d9473bfc95b9bc3edd71f25c11f0b47b27500df9.tar.gz openbsd-d9473bfc95b9bc3edd71f25c11f0b47b27500df9.tar.bz2 openbsd-d9473bfc95b9bc3edd71f25c11f0b47b27500df9.zip | |
BIO_free() returns immediately when the sole input is NULL.
Remove unnecessary NULL check.
ok miod@
Diffstat (limited to 'src/lib/libcrypto')
| -rw-r--r-- | src/lib/libcrypto/asn1/bio_ndef.c | 5 | ||||
| -rw-r--r-- | src/lib/libcrypto/bio/bio_lib.c | 5 | ||||
| -rw-r--r-- | src/lib/libcrypto/bio/bss_acpt.c | 8 | ||||
| -rw-r--r-- | src/lib/libcrypto/cms/cms_lib.c | 5 | ||||
| -rw-r--r-- | src/lib/libcrypto/ocsp/ocsp_ht.c | 5 | ||||
| -rw-r--r-- | src/lib/libcrypto/pkcs7/pk7_doit.c | 5 | ||||
| -rw-r--r-- | src/lib/libcrypto/x509/by_file.c | 8 |
7 files changed, 16 insertions, 25 deletions
diff --git a/src/lib/libcrypto/asn1/bio_ndef.c b/src/lib/libcrypto/asn1/bio_ndef.c index fd6b0e5f17..1a23c27d04 100644 --- a/src/lib/libcrypto/asn1/bio_ndef.c +++ b/src/lib/libcrypto/asn1/bio_ndef.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bio_ndef.c,v 1.8 2014/06/12 15:49:27 deraadt Exp $ */ | 1 | /* $OpenBSD: bio_ndef.c,v 1.9 2014/07/25 06:05:32 doug Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project. | 3 | * project. |
| 4 | */ | 4 | */ |
| @@ -144,8 +144,7 @@ BIO_new_NDEF(BIO *out, ASN1_VALUE *val, const ASN1_ITEM *it) | |||
| 144 | return sarg.ndef_bio; | 144 | return sarg.ndef_bio; |
| 145 | 145 | ||
| 146 | err: | 146 | err: |
| 147 | if (asn_bio) | 147 | BIO_free(asn_bio); |
| 148 | BIO_free(asn_bio); | ||
| 149 | free(ndef_aux); | 148 | free(ndef_aux); |
| 150 | return NULL; | 149 | return NULL; |
| 151 | } | 150 | } |
diff --git a/src/lib/libcrypto/bio/bio_lib.c b/src/lib/libcrypto/bio/bio_lib.c index a2b34a2f80..477208ed1f 100644 --- a/src/lib/libcrypto/bio/bio_lib.c +++ b/src/lib/libcrypto/bio/bio_lib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bio_lib.c,v 1.20 2014/07/11 15:40:32 miod Exp $ */ | 1 | /* $OpenBSD: bio_lib.c,v 1.21 2014/07/25 06:05:32 doug Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -575,8 +575,7 @@ BIO_dup_chain(BIO *in) | |||
| 575 | } | 575 | } |
| 576 | return (ret); | 576 | return (ret); |
| 577 | err: | 577 | err: |
| 578 | if (ret != NULL) | 578 | BIO_free(ret); |
| 579 | BIO_free(ret); | ||
| 580 | return (NULL); | 579 | return (NULL); |
| 581 | 580 | ||
| 582 | } | 581 | } |
diff --git a/src/lib/libcrypto/bio/bss_acpt.c b/src/lib/libcrypto/bio/bss_acpt.c index 65d4bb2547..b6131c4d41 100644 --- a/src/lib/libcrypto/bio/bss_acpt.c +++ b/src/lib/libcrypto/bio/bss_acpt.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bss_acpt.c,v 1.24 2014/07/13 16:03:09 beck Exp $ */ | 1 | /* $OpenBSD: bss_acpt.c,v 1.25 2014/07/25 06:05:32 doug Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -153,8 +153,7 @@ BIO_ACCEPT_free(BIO_ACCEPT *a) | |||
| 153 | 153 | ||
| 154 | free(a->param_addr); | 154 | free(a->param_addr); |
| 155 | free(a->addr); | 155 | free(a->addr); |
| 156 | if (a->bio_chain != NULL) | 156 | BIO_free(a->bio_chain); |
| 157 | BIO_free(a->bio_chain); | ||
| 158 | free(a); | 157 | free(a); |
| 159 | } | 158 | } |
| 160 | 159 | ||
| @@ -358,8 +357,7 @@ acpt_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
| 358 | } else if (num == 1) { | 357 | } else if (num == 1) { |
| 359 | data->accept_nbio = (ptr != NULL); | 358 | data->accept_nbio = (ptr != NULL); |
| 360 | } else if (num == 2) { | 359 | } else if (num == 2) { |
| 361 | if (data->bio_chain != NULL) | 360 | BIO_free(data->bio_chain); |
| 362 | BIO_free(data->bio_chain); | ||
| 363 | data->bio_chain = (BIO *)ptr; | 361 | data->bio_chain = (BIO *)ptr; |
| 364 | } | 362 | } |
| 365 | } | 363 | } |
diff --git a/src/lib/libcrypto/cms/cms_lib.c b/src/lib/libcrypto/cms/cms_lib.c index ee1f06c89a..4ca38e2428 100644 --- a/src/lib/libcrypto/cms/cms_lib.c +++ b/src/lib/libcrypto/cms/cms_lib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: cms_lib.c,v 1.3 2014/06/12 15:49:28 deraadt Exp $ */ | 1 | /* $OpenBSD: cms_lib.c,v 1.4 2014/07/25 06:05:32 doug Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project. | 3 | * project. |
| 4 | */ | 4 | */ |
| @@ -360,8 +360,7 @@ cms_DigestAlgorithm_init_bio(X509_ALGOR *digestAlgorithm) | |||
| 360 | return mdbio; | 360 | return mdbio; |
| 361 | 361 | ||
| 362 | err: | 362 | err: |
| 363 | if (mdbio) | 363 | BIO_free(mdbio); |
| 364 | BIO_free(mdbio); | ||
| 365 | return NULL; | 364 | return NULL; |
| 366 | } | 365 | } |
| 367 | 366 | ||
diff --git a/src/lib/libcrypto/ocsp/ocsp_ht.c b/src/lib/libcrypto/ocsp/ocsp_ht.c index c895e9df4d..5d1627192c 100644 --- a/src/lib/libcrypto/ocsp/ocsp_ht.c +++ b/src/lib/libcrypto/ocsp/ocsp_ht.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ocsp_ht.c,v 1.20 2014/07/12 14:58:32 miod Exp $ */ | 1 | /* $OpenBSD: ocsp_ht.c,v 1.21 2014/07/25 06:05:32 doug Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 2006. | 3 | * project 2006. |
| 4 | */ | 4 | */ |
| @@ -111,8 +111,7 @@ OCSP_REQ_CTX_free(OCSP_REQ_CTX *rctx) | |||
| 111 | if (rctx == NULL) | 111 | if (rctx == NULL) |
| 112 | return; | 112 | return; |
| 113 | 113 | ||
| 114 | if (rctx->mem) | 114 | BIO_free(rctx->mem); |
| 115 | BIO_free(rctx->mem); | ||
| 116 | free(rctx->iobuf); | 115 | free(rctx->iobuf); |
| 117 | free(rctx); | 116 | free(rctx); |
| 118 | } | 117 | } |
diff --git a/src/lib/libcrypto/pkcs7/pk7_doit.c b/src/lib/libcrypto/pkcs7/pk7_doit.c index cc6fd97b9d..8f1e393635 100644 --- a/src/lib/libcrypto/pkcs7/pk7_doit.c +++ b/src/lib/libcrypto/pkcs7/pk7_doit.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: pk7_doit.c,v 1.28 2014/07/12 16:03:37 miod Exp $ */ | 1 | /* $OpenBSD: pk7_doit.c,v 1.29 2014/07/25 06:05:32 doug Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -133,8 +133,7 @@ PKCS7_bio_add_digest(BIO **pbio, X509_ALGOR *alg) | |||
| 133 | return 1; | 133 | return 1; |
| 134 | 134 | ||
| 135 | err: | 135 | err: |
| 136 | if (btmp) | 136 | BIO_free(btmp); |
| 137 | BIO_free(btmp); | ||
| 138 | return 0; | 137 | return 0; |
| 139 | 138 | ||
| 140 | } | 139 | } |
diff --git a/src/lib/libcrypto/x509/by_file.c b/src/lib/libcrypto/x509/by_file.c index 10adcfbd77..04366460bb 100644 --- a/src/lib/libcrypto/x509/by_file.c +++ b/src/lib/libcrypto/x509/by_file.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: by_file.c,v 1.15 2014/07/11 08:44:49 jsing Exp $ */ | 1 | /* $OpenBSD: by_file.c,v 1.16 2014/07/25 06:05:32 doug Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -182,8 +182,7 @@ X509_load_cert_file(X509_LOOKUP *ctx, const char *file, int type) | |||
| 182 | err: | 182 | err: |
| 183 | if (x != NULL) | 183 | if (x != NULL) |
| 184 | X509_free(x); | 184 | X509_free(x); |
| 185 | if (in != NULL) | 185 | BIO_free(in); |
| 186 | BIO_free(in); | ||
| 187 | return (ret); | 186 | return (ret); |
| 188 | } | 187 | } |
| 189 | 188 | ||
| @@ -243,8 +242,7 @@ X509_load_crl_file(X509_LOOKUP *ctx, const char *file, int type) | |||
| 243 | err: | 242 | err: |
| 244 | if (x != NULL) | 243 | if (x != NULL) |
| 245 | X509_CRL_free(x); | 244 | X509_CRL_free(x); |
| 246 | if (in != NULL) | 245 | BIO_free(in); |
| 247 | BIO_free(in); | ||
| 248 | return (ret); | 246 | return (ret); |
| 249 | } | 247 | } |
| 250 | 248 | ||
