summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortb <tb@openbsd.org>2018-07-28 15:25:23 +0000
committertb <tb@openbsd.org>2018-07-28 15:25:23 +0000
commitf53ebcad9e7e8b7ce99500f5fab632f2c45b80ee (patch)
tree6a50fc707f8077d266c964231e3d6cae8a668f6d
parentMake use of PCI_FLAGS_MSI_ENABLED such that drivers for hardware with broken (diff)
downloadwireguard-openbsd-f53ebcad9e7e8b7ce99500f5fab632f2c45b80ee.tar.xz
wireguard-openbsd-f53ebcad9e7e8b7ce99500f5fab632f2c45b80ee.zip
Remove NULL checks before (most) libcrypto *_free() functions.
From Ross L. Richardson, thanks! ok deraadt
-rw-r--r--usr.sbin/acme-client/acctproc.c5
-rw-r--r--usr.sbin/acme-client/certproc.c8
-rw-r--r--usr.sbin/acme-client/keyproc.c5
-rw-r--r--usr.sbin/acme-client/revokeproc.c8
-rw-r--r--usr.sbin/acme-client/rsa.c8
5 files changed, 13 insertions, 21 deletions
diff --git a/usr.sbin/acme-client/acctproc.c b/usr.sbin/acme-client/acctproc.c
index c127ef82f81..2b71fb2ec79 100644
--- a/usr.sbin/acme-client/acctproc.c
+++ b/usr.sbin/acme-client/acctproc.c
@@ -1,4 +1,4 @@
-/* $Id: acctproc.c,v 1.11 2017/01/24 13:32:55 jsing Exp $ */
+/* $Id: acctproc.c,v 1.12 2018/07/28 15:25:23 tb Exp $ */
/*
* Copyright (c) 2016 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -393,8 +393,7 @@ out:
close(netsock);
if (f != NULL)
fclose(f);
- if (pkey != NULL)
- EVP_PKEY_free(pkey);
+ EVP_PKEY_free(pkey);
ERR_print_errors_fp(stderr);
ERR_free_strings();
return rc;
diff --git a/usr.sbin/acme-client/certproc.c b/usr.sbin/acme-client/certproc.c
index 1ceff194975..f2cc4e311a9 100644
--- a/usr.sbin/acme-client/certproc.c
+++ b/usr.sbin/acme-client/certproc.c
@@ -1,4 +1,4 @@
-/* $Id: certproc.c,v 1.10 2017/01/24 13:32:55 jsing Exp $ */
+/* $Id: certproc.c,v 1.11 2018/07/28 15:25:23 tb Exp $ */
/*
* Copyright (c) 2016 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -231,10 +231,8 @@ certproc(int netsock, int filesock)
out:
close(netsock);
close(filesock);
- if (x != NULL)
- X509_free(x);
- if (chainx != NULL)
- X509_free(chainx);
+ X509_free(x);
+ X509_free(chainx);
free(csr);
free(url);
free(chain);
diff --git a/usr.sbin/acme-client/keyproc.c b/usr.sbin/acme-client/keyproc.c
index 4f383792b21..6551a03ebcf 100644
--- a/usr.sbin/acme-client/keyproc.c
+++ b/usr.sbin/acme-client/keyproc.c
@@ -1,4 +1,4 @@
-/* $Id: keyproc.c,v 1.9 2017/03/26 18:41:02 deraadt Exp $ */
+/* $Id: keyproc.c,v 1.10 2018/07/28 15:25:23 tb Exp $ */
/*
* Copyright (c) 2016 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -256,8 +256,7 @@ out:
X509_REQ_free(x);
if (name != NULL)
X509_NAME_free(name);
- if (pkey != NULL)
- EVP_PKEY_free(pkey);
+ EVP_PKEY_free(pkey);
ERR_print_errors_fp(stderr);
ERR_free_strings();
return (rc);
diff --git a/usr.sbin/acme-client/revokeproc.c b/usr.sbin/acme-client/revokeproc.c
index 4365a34ec47..273496c6c74 100644
--- a/usr.sbin/acme-client/revokeproc.c
+++ b/usr.sbin/acme-client/revokeproc.c
@@ -1,4 +1,4 @@
-/* $Id: revokeproc.c,v 1.13 2017/07/08 13:37:23 tb Exp $ */
+/* $Id: revokeproc.c,v 1.14 2018/07/28 15:25:23 tb Exp $ */
/*
* Copyright (c) 2016 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -335,10 +335,8 @@ out:
close(fd);
if (f != NULL)
fclose(f);
- if (x != NULL)
- X509_free(x);
- if (bio != NULL)
- BIO_free(bio);
+ X509_free(x);
+ BIO_free(bio);
free(san);
free(path);
free(der);
diff --git a/usr.sbin/acme-client/rsa.c b/usr.sbin/acme-client/rsa.c
index 35ca61c40cd..798badc7659 100644
--- a/usr.sbin/acme-client/rsa.c
+++ b/usr.sbin/acme-client/rsa.c
@@ -1,4 +1,4 @@
-/* $Id: rsa.c,v 1.6 2017/01/24 13:32:55 jsing Exp $ */
+/* $Id: rsa.c,v 1.7 2018/07/28 15:25:23 tb Exp $ */
/*
* Copyright (c) 2016 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -62,12 +62,10 @@ rsa_key_create(FILE *f, const char *fname)
warnx("%s: PEM_write_PrivateKey", fname);
err:
- if (pkey != NULL)
- EVP_PKEY_free(pkey);
+ EVP_PKEY_free(pkey);
pkey = NULL;
out:
- if (ctx != NULL)
- EVP_PKEY_CTX_free(ctx);
+ EVP_PKEY_CTX_free(ctx);
return pkey;
}