From: Arne Schwabe Date: Tue, 14 Mar 2023 14:48:54 +0000 (+0100) Subject: Fix memory leaks in open_tun_dco() X-Git-Tag: v2.7_alpha1~522 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=021952705ba4b77a1d94bec85f6f02e6c612a37e;p=thirdparty%2Fopenvpn.git Fix memory leaks in open_tun_dco() open_tun_dco_generic() already allocates the tt->actual_name string, which shadows the allocation in the FreeBSD/Linux specific methods. Found-By: clang with asan Change-Id: I51f5fcfff4e5f8203fdb9aec0245cfccd17043cc Signed-off-by: Arne Schwabe Acked-by: Gert Doering Message-Id: <20230314144854.182110-2-arne@rfc2549.org> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg26411.html Signed-off-by: Gert Doering --- diff --git a/src/openvpn/dco_freebsd.c b/src/openvpn/dco_freebsd.c index ecca2a076..225b3cf88 100644 --- a/src/openvpn/dco_freebsd.c +++ b/src/openvpn/dco_freebsd.c @@ -232,7 +232,6 @@ create_interface(struct tuntap *tt, const char *dev) } snprintf(tt->dco.ifname, IFNAMSIZ, "%s", ifr.ifr_data); - tt->actual_name = string_alloc(tt->dco.ifname, NULL); /* see "Interface Flags" in ifnet(9) */ int i = IFF_POINTOPOINT | IFF_MULTICAST; diff --git a/src/openvpn/dco_linux.c b/src/openvpn/dco_linux.c index b2fdbf53f..e5cea3c71 100644 --- a/src/openvpn/dco_linux.c +++ b/src/openvpn/dco_linux.c @@ -457,7 +457,6 @@ open_tun_dco(struct tuntap *tt, openvpn_net_ctx_t *ctx, const char *dev) msg(M_FATAL, "DCO: cannot retrieve ifindex for interface %s", dev); } - tt->actual_name = string_alloc(dev, NULL); tt->dco.dco_message_peer_id = -1; ovpn_dco_register(&tt->dco);