Hi, On Wed, Jun 13, 2018 at 04:12:15PM +0800, Antonio Quartulli wrote: > From: Antonio Quartulli <anto...@openvpn.net> > > Everytime a argv object is initialized with argv_new(), it has > to be released with argv_reset() once not needed anymore. > > The same holds for gc_arena objects initialized with gc_new() that > have to be released with gc_free(). > > Ensure both kind of objects are always properly released to avoid > memory leaks.
This is good housekeeping. Still, I need to NAK this, because I never agree to anything on the first go ;-) Specifically... > Signed-off-by: Antonio Quartulli <anto...@openvpn.net> > --- > src/openvpn/tun.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c > index 3eb0f78a..466d4d42 100644 > --- a/src/openvpn/tun.c > +++ b/src/openvpn/tun.c > @@ -2615,6 +2615,8 @@ close_tun(struct tuntap *tt) > openvpn_execve_check(&argv, NULL, 0, "OpenBSD 'destroy tun > interface' failed (non-critical)"); > > free(tt); > + argv_reset(&argv); > + gc_free(&gc); > } > } While this is technically correct, the gc_arena is not used at all in this close_tun() instance (OPENBSD). So, please do not add a cleanup call, but just remove the "struct gc_arena gc = gc_new()" call instead. The same holds for the NETBSD and AIX variants - gc/argv initialized, but only argv used. So, please remove gc_arena instead :-) (Side note: the FREEBSD close_tun() variant is mostly the same, but does not have a gc_arena ... seems someone already stumbled across that one and fixed it) ACK on the remaining AIX argv_reset() - oops, that was me :-) gert -- "If was one thing all people took for granted, was conviction that if you feed honest figures into a computer, honest figures come out. Never doubted it myself till I met a computer with a sense of humor." Robert A. Heinlein, The Moon is a Harsh Mistress Gert Doering - Munich, Germany g...@greenie.muc.de
signature.asc
Description: PGP signature
------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________ Openvpn-devel mailing list Openvpn-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openvpn-devel