]> git.ipfire.org Git - thirdparty/openvpn.git/commit
Remove NULL checks before calling free
authorArne Schwabe <arne@rfc2549.org>
Fri, 23 Oct 2020 11:34:31 +0000 (13:34 +0200)
committerGert Doering <gert@greenie.muc.de>
Sat, 24 Oct 2020 19:49:40 +0000 (21:49 +0200)
commitcb70cf51889ee96446ba77a406bb2ac0f01dc174
tree405c0f1c0923f52ad644bd021d337401b465438a
parent2c8a9877617727438cdd874ecd38c04adebf53ad
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>
20 files changed:
sample/sample-plugins/client-connect/sample-client-connect.c
src/openvpn/buffer.c
src/openvpn/error.c
src/openvpn/init.c
src/openvpn/manage.c
src/openvpn/mtcp.c
src/openvpn/multi.c
src/openvpn/packet_id.c
src/openvpn/pkcs11.c
src/openvpn/pkcs11_openssl.c
src/openvpn/proxy.c
src/openvpn/ssl.c
src/openvpn/ssl_mbedtls.c
src/openvpn/ssl_openssl.c
src/openvpn/ssl_verify.c
src/openvpn/ssl_verify_openssl.c
src/openvpn/status.c
src/openvpn/tun.c
src/plugins/auth-pam/auth-pam.c
src/plugins/down-root/down-root.c