summaryrefslogtreecommitdiffstats
path: root/lib/libssl/src
diff options
context:
space:
mode:
authordoug <doug@openbsd.org>2014-07-25 06:05:31 +0000
committerdoug <doug@openbsd.org>2014-07-25 06:05:31 +0000
commit68d88c35f6311ff09548698e9d5bb46a5c686a81 (patch)
tree5e9db4c8587412f1c891486410749396e383c2d8 /lib/libssl/src
parentdocument the scheduler types and how to specify them. (diff)
downloadwireguard-openbsd-68d88c35f6311ff09548698e9d5bb46a5c686a81.tar.xz
wireguard-openbsd-68d88c35f6311ff09548698e9d5bb46a5c686a81.zip
BIO_free() returns immediately when the sole input is NULL.
Remove unnecessary NULL check. ok miod@
Diffstat (limited to 'lib/libssl/src')
-rw-r--r--lib/libssl/src/apps/apps.c11
-rw-r--r--lib/libssl/src/apps/dh.c5
-rw-r--r--lib/libssl/src/apps/dhparam.c5
-rw-r--r--lib/libssl/src/apps/dsa.c5
-rw-r--r--lib/libssl/src/apps/dsaparam.c5
-rw-r--r--lib/libssl/src/apps/ec.c5
-rw-r--r--lib/libssl/src/apps/ecparam.c5
-rw-r--r--lib/libssl/src/apps/enc.c14
-rw-r--r--lib/libssl/src/apps/gendsa.c5
-rw-r--r--lib/libssl/src/apps/passwd.c5
-rw-r--r--lib/libssl/src/apps/s_server.c5
-rw-r--r--lib/libssl/src/apps/sess_id.c5
-rw-r--r--lib/libssl/src/crypto/asn1/bio_ndef.c5
-rw-r--r--lib/libssl/src/crypto/bio/bio_lib.c5
-rw-r--r--lib/libssl/src/crypto/bio/bss_acpt.c8
-rw-r--r--lib/libssl/src/crypto/cms/cms_lib.c5
-rw-r--r--lib/libssl/src/crypto/ocsp/ocsp_ht.c5
-rw-r--r--lib/libssl/src/crypto/pkcs7/pk7_doit.c5
-rw-r--r--lib/libssl/src/crypto/x509/by_file.c8
19 files changed, 45 insertions, 71 deletions
diff --git a/lib/libssl/src/apps/apps.c b/lib/libssl/src/apps/apps.c
index f9e845246fb..7e7086a1c71 100644
--- a/lib/libssl/src/apps/apps.c
+++ b/lib/libssl/src/apps/apps.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: apps.c,v 1.68 2014/07/19 03:40:26 lteo Exp $ */
+/* $OpenBSD: apps.c,v 1.69 2014/07/25 06:05:31 doug Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -669,8 +669,7 @@ end:
BIO_printf(err, "unable to load certificate\n");
ERR_print_errors(err);
}
- if (cert != NULL)
- BIO_free(cert);
+ BIO_free(cert);
return (x);
}
@@ -745,8 +744,7 @@ load_key(BIO *err, const char *file, int format, int maybe_stdin,
goto end;
}
end:
- if (key != NULL)
- BIO_free(key);
+ BIO_free(key);
if (pkey == NULL) {
BIO_printf(err, "unable to load %s\n", key_descrip);
ERR_print_errors(err);
@@ -833,8 +831,7 @@ load_pubkey(BIO *err, const char *file, int format, int maybe_stdin,
}
end:
- if (key != NULL)
- BIO_free(key);
+ BIO_free(key);
if (pkey == NULL)
BIO_printf(err, "unable to load %s\n", key_descrip);
return (pkey);
diff --git a/lib/libssl/src/apps/dh.c b/lib/libssl/src/apps/dh.c
index 1485dedb555..ce000820f0b 100644
--- a/lib/libssl/src/apps/dh.c
+++ b/lib/libssl/src/apps/dh.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dh.c,v 1.25 2014/07/14 00:35:10 deraadt Exp $ */
+/* $OpenBSD: dh.c,v 1.26 2014/07/25 06:05:31 doug Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -297,8 +297,7 @@ bad:
ret = 0;
end:
- if (in != NULL)
- BIO_free(in);
+ BIO_free(in);
if (out != NULL)
BIO_free_all(out);
if (dh != NULL)
diff --git a/lib/libssl/src/apps/dhparam.c b/lib/libssl/src/apps/dhparam.c
index 23fb2a57898..1c41ff6e1b6 100644
--- a/lib/libssl/src/apps/dhparam.c
+++ b/lib/libssl/src/apps/dhparam.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhparam.c,v 1.33 2014/07/14 00:35:10 deraadt Exp $ */
+/* $OpenBSD: dhparam.c,v 1.34 2014/07/25 06:05:31 doug Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -441,8 +441,7 @@ bad:
ret = 0;
end:
- if (in != NULL)
- BIO_free(in);
+ BIO_free(in);
if (out != NULL)
BIO_free_all(out);
if (dh != NULL)
diff --git a/lib/libssl/src/apps/dsa.c b/lib/libssl/src/apps/dsa.c
index 287ecc4cda8..2b90d4fb1ae 100644
--- a/lib/libssl/src/apps/dsa.c
+++ b/lib/libssl/src/apps/dsa.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dsa.c,v 1.28 2014/07/14 00:35:10 deraadt Exp $ */
+/* $OpenBSD: dsa.c,v 1.29 2014/07/25 06:05:31 doug Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -320,8 +320,7 @@ bad:
} else
ret = 0;
end:
- if (in != NULL)
- BIO_free(in);
+ BIO_free(in);
if (out != NULL)
BIO_free_all(out);
if (dsa != NULL)
diff --git a/lib/libssl/src/apps/dsaparam.c b/lib/libssl/src/apps/dsaparam.c
index 5980da69b0e..46f41a57fba 100644
--- a/lib/libssl/src/apps/dsaparam.c
+++ b/lib/libssl/src/apps/dsaparam.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dsaparam.c,v 1.34 2014/07/14 00:35:10 deraadt Exp $ */
+/* $OpenBSD: dsaparam.c,v 1.35 2014/07/25 06:05:31 doug Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -382,8 +382,7 @@ bad:
ret = 0;
end:
- if (in != NULL)
- BIO_free(in);
+ BIO_free(in);
if (out != NULL)
BIO_free_all(out);
if (dsa != NULL)
diff --git a/lib/libssl/src/apps/ec.c b/lib/libssl/src/apps/ec.c
index e60fddf99e4..82a98dd21f6 100644
--- a/lib/libssl/src/apps/ec.c
+++ b/lib/libssl/src/apps/ec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ec.c,v 1.16 2014/07/14 00:35:10 deraadt Exp $ */
+/* $OpenBSD: ec.c,v 1.17 2014/07/25 06:05:32 doug Exp $ */
/*
* Written by Nils Larsch for the OpenSSL project.
*/
@@ -328,8 +328,7 @@ bad:
} else
ret = 0;
end:
- if (in)
- BIO_free(in);
+ BIO_free(in);
if (out)
BIO_free_all(out);
if (eckey)
diff --git a/lib/libssl/src/apps/ecparam.c b/lib/libssl/src/apps/ecparam.c
index e8e843ed20e..9f7c287d9cb 100644
--- a/lib/libssl/src/apps/ecparam.c
+++ b/lib/libssl/src/apps/ecparam.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ecparam.c,v 1.23 2014/07/14 00:35:10 deraadt Exp $ */
+/* $OpenBSD: ecparam.c,v 1.24 2014/07/25 06:05:32 doug Exp $ */
/*
* Written by Nils Larsch for the OpenSSL project.
*/
@@ -578,8 +578,7 @@ end:
if (ec_cofactor)
BN_free(ec_cofactor);
free(buffer);
- if (in != NULL)
- BIO_free(in);
+ BIO_free(in);
if (out != NULL)
BIO_free_all(out);
if (group != NULL)
diff --git a/lib/libssl/src/apps/enc.c b/lib/libssl/src/apps/enc.c
index 34642909185..d1943bfa229 100644
--- a/lib/libssl/src/apps/enc.c
+++ b/lib/libssl/src/apps/enc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: enc.c,v 1.38 2014/07/14 00:35:10 deraadt Exp $ */
+/* $OpenBSD: enc.c,v 1.39 2014/07/25 06:05:32 doug Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -600,17 +600,13 @@ end:
ERR_print_errors(bio_err);
free(strbuf);
free(buff);
- if (in != NULL)
- BIO_free(in);
+ BIO_free(in);
if (out != NULL)
BIO_free_all(out);
- if (benc != NULL)
- BIO_free(benc);
- if (b64 != NULL)
- BIO_free(b64);
+ BIO_free(benc);
+ BIO_free(b64);
#ifdef ZLIB
- if (bzl != NULL)
- BIO_free(bzl);
+ BIO_free(bzl);
#endif
free(pass);
diff --git a/lib/libssl/src/apps/gendsa.c b/lib/libssl/src/apps/gendsa.c
index 919b40af833..d45e237103c 100644
--- a/lib/libssl/src/apps/gendsa.c
+++ b/lib/libssl/src/apps/gendsa.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: gendsa.c,v 1.30 2014/07/14 00:35:10 deraadt Exp $ */
+/* $OpenBSD: gendsa.c,v 1.31 2014/07/25 06:05:32 doug Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -219,8 +219,7 @@ bad:
end:
if (ret != 0)
ERR_print_errors(bio_err);
- if (in != NULL)
- BIO_free(in);
+ BIO_free(in);
if (out != NULL)
BIO_free_all(out);
if (dsa != NULL)
diff --git a/lib/libssl/src/apps/passwd.c b/lib/libssl/src/apps/passwd.c
index b9a74bbd0cb..6a16a475a96 100644
--- a/lib/libssl/src/apps/passwd.c
+++ b/lib/libssl/src/apps/passwd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: passwd.c,v 1.23 2014/07/14 00:35:10 deraadt Exp $ */
+/* $OpenBSD: passwd.c,v 1.24 2014/07/25 06:05:32 doug Exp $ */
#if defined OPENSSL_NO_MD5
#define NO_MD5CRYPT_1
@@ -242,8 +242,7 @@ err:
ERR_print_errors(bio_err);
free(salt_malloc);
free(passwd_malloc);
- if (in)
- BIO_free(in);
+ BIO_free(in);
if (out)
BIO_free_all(out);
diff --git a/lib/libssl/src/apps/s_server.c b/lib/libssl/src/apps/s_server.c
index b6e16f31aee..3deebcfc35a 100644
--- a/lib/libssl/src/apps/s_server.c
+++ b/lib/libssl/src/apps/s_server.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: s_server.c,v 1.61 2014/07/14 00:35:10 deraadt Exp $ */
+/* $OpenBSD: s_server.c,v 1.62 2014/07/25 06:05:32 doug Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -1773,8 +1773,7 @@ load_dh_param(const char *dhfile)
goto err;
ret = PEM_read_bio_DHparams(bio, NULL, NULL, NULL);
err:
- if (bio != NULL)
- BIO_free(bio);
+ BIO_free(bio);
return (ret);
}
#endif
diff --git a/lib/libssl/src/apps/sess_id.c b/lib/libssl/src/apps/sess_id.c
index e841003cf6c..0022abc4368 100644
--- a/lib/libssl/src/apps/sess_id.c
+++ b/lib/libssl/src/apps/sess_id.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sess_id.c,v 1.19 2014/07/14 00:35:10 deraadt Exp $ */
+/* $OpenBSD: sess_id.c,v 1.20 2014/07/25 06:05:32 doug Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -277,7 +277,6 @@ load_sess_id(char *infile, int format)
goto end;
}
end:
- if (in != NULL)
- BIO_free(in);
+ BIO_free(in);
return (x);
}
diff --git a/lib/libssl/src/crypto/asn1/bio_ndef.c b/lib/libssl/src/crypto/asn1/bio_ndef.c
index fd6b0e5f178..1a23c27d041 100644
--- a/lib/libssl/src/crypto/asn1/bio_ndef.c
+++ b/lib/libssl/src/crypto/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/libssl/src/crypto/bio/bio_lib.c b/lib/libssl/src/crypto/bio/bio_lib.c
index a2b34a2f80f..477208ed1f1 100644
--- a/lib/libssl/src/crypto/bio/bio_lib.c
+++ b/lib/libssl/src/crypto/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/libssl/src/crypto/bio/bss_acpt.c b/lib/libssl/src/crypto/bio/bss_acpt.c
index 65d4bb25478..b6131c4d41a 100644
--- a/lib/libssl/src/crypto/bio/bss_acpt.c
+++ b/lib/libssl/src/crypto/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/libssl/src/crypto/cms/cms_lib.c b/lib/libssl/src/crypto/cms/cms_lib.c
index ee1f06c89ab..4ca38e24288 100644
--- a/lib/libssl/src/crypto/cms/cms_lib.c
+++ b/lib/libssl/src/crypto/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/libssl/src/crypto/ocsp/ocsp_ht.c b/lib/libssl/src/crypto/ocsp/ocsp_ht.c
index c895e9df4db..5d1627192cc 100644
--- a/lib/libssl/src/crypto/ocsp/ocsp_ht.c
+++ b/lib/libssl/src/crypto/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/libssl/src/crypto/pkcs7/pk7_doit.c b/lib/libssl/src/crypto/pkcs7/pk7_doit.c
index cc6fd97b9de..8f1e3936356 100644
--- a/lib/libssl/src/crypto/pkcs7/pk7_doit.c
+++ b/lib/libssl/src/crypto/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/libssl/src/crypto/x509/by_file.c b/lib/libssl/src/crypto/x509/by_file.c
index 10adcfbd772..04366460bb0 100644
--- a/lib/libssl/src/crypto/x509/by_file.c
+++ b/lib/libssl/src/crypto/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);
}