diff options
author | Arne Schwabe | 2020-10-23 13:34:31 +0200 |
---|---|---|
committer | Gert Doering | 2020-10-24 21:49:40 +0200 |
commit | cb70cf51889ee96446ba77a406bb2ac0f01dc174 (patch) | |
tree | 405c0f1c0923f52ad644bd021d337401b465438a /src/plugins/auth-pam | |
parent | 2c8a9877617727438cdd874ecd38c04adebf53ad (diff) | |
download | openvpn-cb70cf51889ee96446ba77a406bb2ac0f01dc174.zip openvpn-cb70cf51889ee96446ba77a406bb2ac0f01dc174.tar.gz |
Remove NULL checks before calling free
We (and OpenSSL) already use calling free on null pointers in a number
of places and also C99 standards says free(NULL) does nothing.
The if (x) free(x) calls more often make code harder to read, instead
of easier, remove these NULL checks in favour of directly calling
free(x).
The OpenSSL *_free methods are also safe to call with NULL and
pkcs11h_certificate_freeCertificateIdList is also safe to be called with
NULL.
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20201023113431.26691-5-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg21216.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
Diffstat (limited to 'src/plugins/auth-pam')
-rw-r--r-- | src/plugins/auth-pam/auth-pam.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/src/plugins/auth-pam/auth-pam.c b/src/plugins/auth-pam/auth-pam.c index f537652..3d16723 100644 --- a/src/plugins/auth-pam/auth-pam.c +++ b/src/plugins/auth-pam/auth-pam.c @@ -506,10 +506,7 @@ openvpn_plugin_open_v3(const int v3structver, } error: - if (context) - { - free(context); - } + free(context); return OPENVPN_PLUGIN_FUNC_ERROR; } |