]> git.ipfire.org Git - thirdparty/openvpn.git/commit
argv: do fewer memory re-allocations
authorHeiko Hund <heiko.hund@sophos.com>
Thu, 6 Feb 2020 13:21:01 +0000 (14:21 +0100)
committerDavid Sommerseth <davids@openvpn.net>
Thu, 20 Feb 2020 15:40:20 +0000 (16:40 +0100)
commit870e2405e27fb0c119ade6fc0032c81af4d89819
tree2478ab59b8020a402ce316c43944bace8b82a05f
parent4ed7bf7f94a8cecbc2430d8025a2b8a46f94e429
argv: do fewer memory re-allocations

Prevent the re-allocations of memory when the internal argv grows
beyond 2 and 4 arguments by initially allocating argv to hold up to
7 (+ trailing NULL) pointers.

While at it rename argv_reset to argv_free to actually express
what's going on. Redo the argv_reset functionality so that it can
be used to actually reset the argv without re-allocation.

Signed-off-by: Heiko Hund <heiko.hund@sophos.com>
Signed-off-by: David Sommerseth <davids@openvpn.net>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <20200206132103.15977-3-davids@openvpn.net>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg19378.html
15 files changed:
src/openvpn/argv.c
src/openvpn/argv.h
src/openvpn/console_systemd.c
src/openvpn/init.c
src/openvpn/lladdr.c
src/openvpn/multi.c
src/openvpn/networking_iproute2.c
src/openvpn/options.c
src/openvpn/plugin.c
src/openvpn/route.c
src/openvpn/socket.c
src/openvpn/ssl_verify.c
src/openvpn/tls_crypt.c
src/openvpn/tun.c
tests/unit_tests/openvpn/test_argv.c