Skip to contentSkip to conversation

Properly free tuntap struct on android when emulating persist-tun

PATCH In review Arne Schwabe 2 participants 2 messages Sep 12, 2018 – Sep 25, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Properly free tuntap struct on android when emulating persist-tun

Trac-Ticket: #851

---
 src/openvpn/init.c | 3 +++
 1 file changed, 3 insertions(+)
src/openvpn/init.c +3 -0
index 2933d555..b1f4320a 100644
@@ -1680,6 +1680,9 @@ do_open_tun(struct context *c)
     if (c->c1.tuntap)
     {
         oldtunfd = c->c1.tuntap->fd;
+        free(c->c1.tuntap);
+        c->c1.tuntap = NULL;
+        c->c1.tuntap_owned = false;
     }
 #endif
 
Signature · 1 line
2.18.0
Acked-by on v1 1/1
#1 lore raw

"It does what it says on the lid" - do_init_tun() will allocate a new struct tuntap, so if we have one beforehand, it needs free()ing.

I have not actively *tested* it, as I have no test rig for building Android binaries - OTOH, if the one who gets all the blame for Android says it's ok, I'm going to believe it (no other platform affected).

Your patch has been applied to the master and release/2.4 branch (2.4 mostly due to "it's a bugfix, it's a single platform, and to keep the code similar for future changes").

commit da3f583f30a4b2be9cc5501874373fc4f627158d (master) commit 21a307dd7252a066f204dee52a4cf569a4a48a1d (release/2.4)

Author: Arne Schwabe
Date:   Wed Sep 12 13:07:01 2018 +0200
     Properly free tuntap struct on android when emulating persist-tun

     Acked-by: Gert Doering <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg17460.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering